[libclc] [LIBCLC] Teach prepare-builtins how to handle text based IR (PR #66993)

Jakub Chlanda via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 21 06:17:53 PDT 2023


================
@@ -5,30 +5,37 @@
 #include "llvm/Bitcode/ReaderWriter.h"
 #endif
 
+#include "llvm/Config/llvm-config.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/GlobalVariable.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IRReader/IRReader.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/raw_ostream.h"
-#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/ToolOutputFile.h"
-#include "llvm/Config/llvm-config.h"
+#include "llvm/Support/raw_ostream.h"
 
 #include <system_error>
 
 using namespace llvm;
 
+static ExitOnError ExitOnErr;
+
 static cl::opt<std::string>
 InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
 
 static cl::opt<std::string>
 OutputFilename("o", cl::desc("Output filename"),
                cl::value_desc("filename"));
 
+static cl::opt<bool> TextualOut("S", cl::desc("Emit LLVM textual assembly"),
----------------
jchlanda wrote:

The default is to output the binary IR, regardless of the input format. And the `S` switch overrides the input type, so providing the tool with binary IR, while specifying `-S` results in textual IR output.

https://github.com/llvm/llvm-project/pull/66993


More information about the cfe-commits mailing list