llvm.org GIT mirror llvm / 9b2a3ba
Support: Fix incremental build when re-configuring targets r180893 added an indirect include of llvm/Config/Targets.def to llvm/Support/CodeGen.h, which in turn is included by things like llvm/IR/Module.h. After a full build of LLVM and Clang, ninja had to rebuild 1274 files after reconfiguring. This commit strips CodeGen.h back down to just a pile of enums and moves the expensive includes over to CodeGenCWrappers.h (which is only included in two places). This gets ninja down to 88 files if you reconfigure with, e.g., -DLLVM_TARGETS_TO_BUILD=X86. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260835 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 4 years ago
4 changed file(s) with 67 addition(s) and 40 deletion(s). Raw diff Collapse all Expand all
1414 #ifndef LLVM_SUPPORT_CODEGEN_H
1515 #define LLVM_SUPPORT_CODEGEN_H
1616
17 #include "llvm-c/TargetMachine.h"
18 #include "llvm/Support/ErrorHandling.h"
19
2017 namespace llvm {
2118
2219 // Relocation model types.
2623
2724 // Code model types.
2825 namespace CodeModel {
26 // Sync changes with CodeGenCWrappers.h.
2927 enum Model { Default, JITDefault, Small, Kernel, Medium, Large };
3028 }
3129
5351 };
5452 }
5553
56 // Create wrappers for C Binding types (see CBindingWrapping.h).
57 inline CodeModel::Model unwrap(LLVMCodeModel Model) {
58 switch (Model) {
59 case LLVMCodeModelDefault:
60 return CodeModel::Default;
61 case LLVMCodeModelJITDefault:
62 return CodeModel::JITDefault;
63 case LLVMCodeModelSmall:
64 return CodeModel::Small;
65 case LLVMCodeModelKernel:
66 return CodeModel::Kernel;
67 case LLVMCodeModelMedium:
68 return CodeModel::Medium;
69 case LLVMCodeModelLarge:
70 return CodeModel::Large;
71 }
72 return CodeModel::Default;
73 }
74
75 inline LLVMCodeModel wrap(CodeModel::Model Model) {
76 switch (Model) {
77 case CodeModel::Default:
78 return LLVMCodeModelDefault;
79 case CodeModel::JITDefault:
80 return LLVMCodeModelJITDefault;
81 case CodeModel::Small:
82 return LLVMCodeModelSmall;
83 case CodeModel::Kernel:
84 return LLVMCodeModelKernel;
85 case CodeModel::Medium:
86 return LLVMCodeModelMedium;
87 case CodeModel::Large:
88 return LLVMCodeModelLarge;
89 }
90 llvm_unreachable("Bad CodeModel!");
91 }
9254 } // end llvm namespace
9355
9456 #endif
0 //===- llvm/Support/CodeGenCWrappers.h - CodeGen C Wrappers -----*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines C bindings wrappers for enums in llvm/Support/CodeGen.h
10 // that need them. The wrappers are separated to avoid adding an indirect
11 // dependency on llvm/Config/Targets.def to CodeGen.h.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_SUPPORT_CODEGENCWRAPPERS_H
16 #define LLVM_SUPPORT_CODEGENCWRAPPERS_H
17
18 #include "llvm-c/TargetMachine.h"
19 #include "llvm/Support/ErrorHandling.h"
20 #include "llvm/Support/CodeGenCWrappers.h"
21
22 namespace llvm {
23
24 inline CodeModel::Model unwrap(LLVMCodeModel Model) {
25 switch (Model) {
26 case LLVMCodeModelDefault:
27 return CodeModel::Default;
28 case LLVMCodeModelJITDefault:
29 return CodeModel::JITDefault;
30 case LLVMCodeModelSmall:
31 return CodeModel::Small;
32 case LLVMCodeModelKernel:
33 return CodeModel::Kernel;
34 case LLVMCodeModelMedium:
35 return CodeModel::Medium;
36 case LLVMCodeModelLarge:
37 return CodeModel::Large;
38 }
39 return CodeModel::Default;
40 }
41
42 inline LLVMCodeModel wrap(CodeModel::Model Model) {
43 switch (Model) {
44 case CodeModel::Default:
45 return LLVMCodeModelDefault;
46 case CodeModel::JITDefault:
47 return LLVMCodeModelJITDefault;
48 case CodeModel::Small:
49 return LLVMCodeModelSmall;
50 case CodeModel::Kernel:
51 return LLVMCodeModelKernel;
52 case CodeModel::Medium:
53 return LLVMCodeModelMedium;
54 case CodeModel::Large:
55 return LLVMCodeModelLarge;
56 }
57 llvm_unreachable("Bad CodeModel!");
58 }
59
60 } // end llvm namespace
61
62 #endif
63
1616 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
1717 #include "llvm/IR/DerivedTypes.h"
1818 #include "llvm/IR/Module.h"
19 #include "llvm/Support/CodeGenCWrappers.h"
1920 #include "llvm/Support/ErrorHandling.h"
2021 #include "llvm/Target/TargetOptions.h"
2122 #include
1717 #include "llvm/IR/DataLayout.h"
1818 #include "llvm/IR/Module.h"
1919 #include "llvm/IR/LegacyPassManager.h"
20 #include "llvm/Support/CodeGen.h"
20 #include "llvm/Support/CodeGenCWrappers.h"
2121 #include "llvm/Support/FileSystem.h"
2222 #include "llvm/Support/FormattedStream.h"
2323 #include "llvm/Support/Host.h"