LLVM  3.7.0
CodeGen.h
Go to the documentation of this file.
1 //===-- llvm/Support/CodeGen.h - CodeGen Concepts ---------------*- 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 define some types which define code generation concepts. For
11 // example, relocation model.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_SUPPORT_CODEGEN_H
16 #define LLVM_SUPPORT_CODEGEN_H
17 
18 #include "llvm-c/TargetMachine.h"
20 
21 namespace llvm {
22 
23  // Relocation model types.
24  namespace Reloc {
26  }
27 
28  // Code model types.
29  namespace CodeModel {
31  }
32 
33  namespace PICLevel {
34  enum Level { Default=0, Small=1, Large=2 };
35  }
36 
37  // TLS models.
38  namespace TLSModel {
39  enum Model {
44  };
45  }
46 
47  // Code generation optimization level.
48  namespace CodeGenOpt {
49  enum Level {
50  None, // -O0
51  Less, // -O1
52  Default, // -O2, -Os
53  Aggressive // -O3
54  };
55  }
56 
57  // Create wrappers for C Binding types (see CBindingWrapping.h).
59  switch (Model) {
61  return CodeModel::Default;
63  return CodeModel::JITDefault;
64  case LLVMCodeModelSmall:
65  return CodeModel::Small;
67  return CodeModel::Kernel;
69  return CodeModel::Medium;
70  case LLVMCodeModelLarge:
71  return CodeModel::Large;
72  }
73  return CodeModel::Default;
74  }
75 
77  switch (Model) {
78  case CodeModel::Default:
79  return LLVMCodeModelDefault;
82  case CodeModel::Small:
83  return LLVMCodeModelSmall;
84  case CodeModel::Kernel:
85  return LLVMCodeModelKernel;
86  case CodeModel::Medium:
87  return LLVMCodeModelMedium;
88  case CodeModel::Large:
89  return LLVMCodeModelLarge;
90  }
91  llvm_unreachable("Bad CodeModel!");
92  }
93 } // end llvm namespace
94 
95 #endif
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:98
LLVMTargetDataRef wrap(const DataLayout *P)
Definition: DataLayout.h:469
DataLayout * unwrap(LLVMTargetDataRef P)
Definition: DataLayout.h:465
LLVMCodeModel