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/FunctionInfo.h"
     15 #include <memory>
     16 
     17 namespace llvm {
     18   class Module;
     19 }
     20 
     21 namespace clang {
     22   class DiagnosticsEngine;
     23   class CodeGenOptions;
     24   class TargetOptions;
     25   class LangOptions;
     26 
     27   enum BackendAction {
     28     Backend_EmitAssembly,  ///< Emit native assembly files
     29     Backend_EmitBC,        ///< Emit LLVM bitcode files
     30     Backend_EmitLL,        ///< Emit human-readable LLVM assembly
     31     Backend_EmitNothing,   ///< Don't emit anything (benchmarking mode)
     32     Backend_EmitMCNull,    ///< Run CodeGen, but don't emit anything
     33     Backend_EmitObj        ///< Emit native object files
     34   };
     35 
     36   void
     37   EmitBackendOutput(DiagnosticsEngine &Diags, const CodeGenOptions &CGOpts,
     38                     const TargetOptions &TOpts, const LangOptions &LOpts,
     39                     StringRef TDesc, llvm::Module *M, BackendAction Action,
     40                     raw_pwrite_stream *OS,
     41                     std::unique_ptr<llvm::FunctionInfoIndex> Index = nullptr);
     42 }
     43 
     44 #endif
     45