LLVM  4.0.0
CodeGenCWrappers.h
Go to the documentation of this file.
1 //===- llvm/Support/CodeGenCWrappers.h - CodeGen C Wrappers -----*- 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 defines C bindings wrappers for enums in llvm/Support/CodeGen.h
11 // that need them. The wrappers are separated to avoid adding an indirect
12 // dependency on llvm/Config/Targets.def to CodeGen.h.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_SUPPORT_CODEGENCWRAPPERS_H
17 #define LLVM_SUPPORT_CODEGENCWRAPPERS_H
18 
19 #include "llvm-c/TargetMachine.h"
20 #include "llvm/Support/CodeGen.h"
22 
23 namespace llvm {
24 
26  switch (Model) {
28  return CodeModel::Default;
30  return CodeModel::JITDefault;
31  case LLVMCodeModelSmall:
32  return CodeModel::Small;
34  return CodeModel::Kernel;
36  return CodeModel::Medium;
37  case LLVMCodeModelLarge:
38  return CodeModel::Large;
39  }
40  return CodeModel::Default;
41 }
42 
44  switch (Model) {
45  case CodeModel::Default:
46  return LLVMCodeModelDefault;
49  case CodeModel::Small:
50  return LLVMCodeModelSmall;
51  case CodeModel::Kernel:
52  return LLVMCodeModelKernel;
53  case CodeModel::Medium:
54  return LLVMCodeModelMedium;
55  case CodeModel::Large:
56  return LLVMCodeModelLarge;
57  }
58  llvm_unreachable("Bad CodeModel!");
59 }
60 
61 } // end llvm namespace
62 
63 #endif
64 
Attribute unwrap(LLVMAttributeRef Attr)
Definition: Attributes.h:191
LLVMCodeModel
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:186