LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  // TLS models.
34  namespace TLSModel {
35  enum Model {
40  };
41  }
42 
43  // Code generation optimization level.
44  namespace CodeGenOpt {
45  enum Level {
46  None, // -O0
47  Less, // -O1
48  Default, // -O2, -Os
49  Aggressive // -O3
50  };
51  }
52 
53  // Create wrappers for C Binding types (see CBindingWrapping.h).
55  switch (Model) {
57  return CodeModel::Default;
59  return CodeModel::JITDefault;
60  case LLVMCodeModelSmall:
61  return CodeModel::Small;
63  return CodeModel::Kernel;
65  return CodeModel::Medium;
66  case LLVMCodeModelLarge:
67  return CodeModel::Large;
68  }
69  return CodeModel::Default;
70  }
71 
73  switch (Model) {
74  case CodeModel::Default:
75  return LLVMCodeModelDefault;
78  case CodeModel::Small:
79  return LLVMCodeModelSmall;
80  case CodeModel::Kernel:
81  return LLVMCodeModelKernel;
82  case CodeModel::Medium:
83  return LLVMCodeModelMedium;
84  case CodeModel::Large:
85  return LLVMCodeModelLarge;
86  }
87  llvm_unreachable("Bad CodeModel!");
88  }
89 } // end llvm namespace
90 
91 #endif
LLVMContext ** unwrap(LLVMContextRef *Tys)
Definition: LLVMContext.h:119
#define llvm_unreachable(msg)
LLVMCodeModel
LLVMContextRef * wrap(const LLVMContext **Tys)
Definition: LLVMContext.h:123