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 };
43 // Code generation optimization level.
44 namespace CodeGenOpt {
53 // Create wrappers for C Binding types (see CBindingWrapping.h).
54 inline CodeModel::Model unwrap(LLVMCodeModel Model) {
56 case LLVMCodeModelDefault:
57 return CodeModel::Default;
58 case LLVMCodeModelJITDefault:
59 return CodeModel::JITDefault;
60 case LLVMCodeModelSmall:
61 return CodeModel::Small;
62 case LLVMCodeModelKernel:
63 return CodeModel::Kernel;
64 case LLVMCodeModelMedium:
65 return CodeModel::Medium;
66 case LLVMCodeModelLarge:
67 return CodeModel::Large;
69 return CodeModel::Default;
72 inline LLVMCodeModel wrap(CodeModel::Model Model) {
74 case CodeModel::Default:
75 return LLVMCodeModelDefault;
76 case CodeModel::JITDefault:
77 return LLVMCodeModelJITDefault;
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;
87 llvm_unreachable("Bad CodeModel!");
89 } // end llvm namespace