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