;
28 "Unsupported output type for getBackendActionFromOutputType!");
31 returnBackendAction::Backend_EmitLL;
35llvm_unreachable(
"Unsupported output type!");
38staticstd::unique_ptr<llvm::Module>
45 virtual voidanchor();
51std::unique_ptr<raw_pwrite_stream> OutputStream;
55std::unique_ptr<CIRGenerator> Gen;
59std::unique_ptr<raw_pwrite_stream> OS)
60: Action(Action), CI(CI), OutputStream(
std::move(OS)),
61FS(&CI.getVirtualFileSystem()),
63CI.getCodeGenOpts())) {}
66assert(!Context &&
"initialized multiple times");
72Gen->HandleTopLevelDecl(
D);
77Gen->HandleTranslationUnit(
C);
78mlir::ModuleOp MlirModule = Gen->getModule();
81 if(OutputStream && MlirModule) {
82mlir::OpPrintingFlags Flags;
83Flags.enableDebugInfo(
true,
false);
84MlirModule->print(*OutputStream, Flags);
88llvm::LLVMContext LLVMCtx;
89std::unique_ptr<llvm::Module> LLVMModule =
95LLVMModule.get(), BEAction, FS, std::move(OutputStream));
103voidCIRGenConsumer::anchor() {}
106: MLIRCtx(MLIRCtx ? MLIRCtx : new
mlir::MLIRContext), Action(Act) {}
110staticstd::unique_ptr<raw_pwrite_stream>
119llvm_unreachable(
"Invalid CIRGenAction::OutputType");
122std::unique_ptr<ASTConsumer>
130std::make_unique<cir::CIRGenConsumer>(
Action, CI, std::move(Out));
135voidEmitCIRAction::anchor() {}
139voidEmitLLVMAction::anchor() {}
static std::unique_ptr< raw_pwrite_stream > getOutputStream(CompilerInstance &CI, StringRef InFile, CIRGenAction::OutputType Action)
CIRGenAction(OutputType Action, mlir::MLIRContext *MLIRCtx=nullptr)
std::unique_ptr< clang::ASTConsumer > CreateASTConsumer(clang::CompilerInstance &CI, llvm::StringRef InFile) override
void Initialize(ASTContext &Ctx) override
Initialize - This is called to initialize the consumer, providing the ASTContext.
bool HandleTopLevelDecl(DeclGroupRef D) override
HandleTopLevelDecl - Handle the specified top-level declaration.
void HandleTranslationUnit(ASTContext &C) override
HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been par...
CIRGenConsumer(CIRGenAction::OutputType Action, CompilerInstance &CI, std::unique_ptr< raw_pwrite_stream > OS)
EmitCIRAction(mlir::MLIRContext *MLIRCtx=nullptr)
EmitLLVMAction(mlir::MLIRContext *MLIRCtx=nullptr)
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
std::unique_ptr< raw_pwrite_stream > createDefaultOutputFile(bool Binary=true, StringRef BaseInput="", StringRef Extension="", bool RemoveFileOnSignal=true, bool CreateMissingDirectories=false, bool ForceUseTemporary=false)
Create the default output file (from the invocation's options) and add it to the list of tracked outp...
std::unique_ptr< llvm::raw_pwrite_stream > takeOutputStream()
CodeGenOptions & getCodeGenOpts()
std::unique_ptr< llvm::Module > lowerDirectlyFromCIRToLLVMIR(mlir::ModuleOp mlirModule, llvm::LLVMContext &llvmCtx)
static BackendAction getBackendActionFromOutputType(CIRGenAction::OutputType Action)
static std::unique_ptr< llvm::Module > lowerFromCIRToLLVMIR(mlir::ModuleOp MLIRModule, llvm::LLVMContext &LLVMCtx)
The JSON file list parser is used to communicate input to InstallAPI.
void emitBackendOutput(CompilerInstance &CI, CodeGenOptions &CGOpts, StringRef TDesc, llvm::Module *M, BackendAction Action, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, std::unique_ptr< raw_pwrite_stream > OS, BackendConsumer *BC=nullptr)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4