1 //===-- llvm/MC/MCCodeGenInfo.h - Target CodeGen Info -----------*- 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 // This file tracks information about the target which can affect codegen,
11 // asm parsing, and asm printing. For example, relocation model.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_MC_MCCODEGENINFO_H
16 #define LLVM_MC_MCCODEGENINFO_H
17 
18 #include "llvm/Support/CodeGen.h"
19 
20 namespace llvm {
21 
22 class MCCodeGenInfo {
23   /// RelocationModel - Relocation model: static, pic, etc.
24   ///
25   Reloc::Model RelocationModel;
26 
27   /// CMModel - Code model.
28   ///
29   CodeModel::Model CMModel;
30 
31   /// OptLevel - Optimization level.
32   ///
33   CodeGenOpt::Level OptLevel;
34 
35 public:
36   void initMCCodeGenInfo(Reloc::Model RM = Reloc::Default,
37                          CodeModel::Model CM = CodeModel::Default,
38                          CodeGenOpt::Level OL = CodeGenOpt::Default);
39 
getRelocationModel()40   Reloc::Model getRelocationModel() const { return RelocationModel; }
41 
getCodeModel()42   CodeModel::Model getCodeModel() const { return CMModel; }
43 
getOptLevel()44   CodeGenOpt::Level getOptLevel() const { return OptLevel; }
45 
46   // Allow overriding OptLevel on a per-function basis.
setOptLevel(CodeGenOpt::Level Level)47   void setOptLevel(CodeGenOpt::Level Level) { OptLevel = Level; }
48 };
49 } // namespace llvm
50 
51 #endif
52