1 //===-- llvm/Support/CodeGen.h - CodeGen Concepts ---------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file define some types which define code generation concepts. For
11 // example, relocation model.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_SUPPORT_CODEGEN_H
16 #define LLVM_SUPPORT_CODEGEN_H
18 #include "llvm-c/TargetMachine.h"
19 #include "llvm/Support/ErrorHandling.h"
23 // Relocation model types.
25 enum Model { Default, Static, PIC_, DynamicNoPIC };
30 enum Model { Default, JITDefault, Small, Kernel, Medium, Large };
34 enum Level { Default=0, Small=1, Large=2 };
47 // Code generation optimization level.
48 namespace CodeGenOpt {
57 // Create wrappers for C Binding types (see CBindingWrapping.h).
58 inline CodeModel::Model unwrap(LLVMCodeModel Model) {
60 case LLVMCodeModelDefault:
61 return CodeModel::Default;
62 case LLVMCodeModelJITDefault:
63 return CodeModel::JITDefault;
64 case LLVMCodeModelSmall:
65 return CodeModel::Small;
66 case LLVMCodeModelKernel:
67 return CodeModel::Kernel;
68 case LLVMCodeModelMedium:
69 return CodeModel::Medium;
70 case LLVMCodeModelLarge:
71 return CodeModel::Large;
73 return CodeModel::Default;
76 inline LLVMCodeModel wrap(CodeModel::Model Model) {
78 case CodeModel::Default:
79 return LLVMCodeModelDefault;
80 case CodeModel::JITDefault:
81 return LLVMCodeModelJITDefault;
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;
91 llvm_unreachable("Bad CodeModel!");
93 } // end llvm namespace