Home | History | Annotate | Download | only in CodeGen
      1 //===--- BackendUtil.h - LLVM Backend Utilities -----------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #ifndef LLVM_CLANG_CODEGEN_BACKENDUTIL_H
     11 #define LLVM_CLANG_CODEGEN_BACKENDUTIL_H
     12 
     13 #include "clang/Basic/LLVM.h"
     14 #include "llvm/IR/ModuleSummaryIndex.h"
     15 #include <memory>
     16 
     17 namespace llvm {
     18   class Module;
     19   class MemoryBufferRef;
     20 }
     21 
     22 namespace clang {
     23   class DiagnosticsEngine;
     24   class CodeGenOptions;
     25   class TargetOptions;
     26   class LangOptions;
     27 
     28   enum BackendAction {
     29     Backend_EmitAssembly,  ///< Emit native assembly files
     30     Backend_EmitBC,        ///< Emit LLVM bitcode files
     31     Backend_EmitLL,        ///< Emit human-readable LLVM assembly
     32     Backend_EmitNothing,   ///< Don't emit anything (benchmarking mode)
     33     Backend_EmitMCNull,    ///< Run CodeGen, but don't emit anything
     34     Backend_EmitObj        ///< Emit native object files
     35   };
     36 
     37   void EmitBackendOutput(DiagnosticsEngine &Diags, const CodeGenOptions &CGOpts,
     38                          const TargetOptions &TOpts, const LangOptions &LOpts,
     39                          const llvm::DataLayout &TDesc, llvm::Module *M,
     40                          BackendAction Action, raw_pwrite_stream *OS);
     41 
     42   void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
     43                     llvm::MemoryBufferRef Buf);
     44 }
     45 
     46 #endif
     47