llvm.org GIT mirror llvm / ae5f5d3
Move the global variables representing each Target behind accessor function This avoids "static initialization order fiasco" Differential Revision: https://reviews.llvm.org/D25412 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283702 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 3 years ago
102 changed file(s) with 494 addition(s) and 352 deletion(s). Raw diff Collapse all Expand all
287287
288288 .. code-block:: c++
289289
290 Target llvm::TheSparcTarget;
290 Target llvm::getTheSparcTarget();
291291
292292 extern "C" void LLVMInitializeSparcTargetInfo() {
293293 RegisterTarget
294 X(TheSparcTarget, "sparc", "Sparc");
294 X(getTheSparcTarget(), "sparc", "Sparc");
295295 }
296296
297297 This allows the ``TargetRegistry`` to look up the target by name or by target
304304 .. code-block:: c++
305305
306306 extern "C" void LLVMInitializeSparcAsmPrinter() {
307 RegisterAsmPrinter X(TheSparcTarget);
307 RegisterAsmPrinter X(getTheSparcTarget());
308308 }
309309
310310 For more information, see "`llvm/Target/TargetRegistry.h
848848 /// target's initialization function. Usage:
849849 ///
850850 ///
851 /// Target TheFooTarget; // The global target instance.
852 ///
851 /// Target &getTheFooTarget() { // The global target instance.
852 /// static Target TheFooTarget;
853 /// return TheFooTarget;
854 /// }
853855 /// extern "C" void LLVMInitializeFooTargetInfo() {
854 /// RegisterTarget X(TheFooTarget, "foo", "Foo description");
856 /// RegisterTarget X(getTheFooTarget(), "foo", "Foo
857 /// description");
855858 /// }
856859 template
857860 bool HasJIT = false>
576576
577577 // Force static initialization.
578578 extern "C" void LLVMInitializeAArch64AsmPrinter() {
579 RegisterAsmPrinter X(TheAArch64leTarget);
580 RegisterAsmPrinter Y(TheAArch64beTarget);
581 RegisterAsmPrinter Z(TheARM64Target);
582 }
579 RegisterAsmPrinter X(getTheAArch64leTarget());
580 RegisterAsmPrinter Y(getTheAArch64beTarget());
581 RegisterAsmPrinter Z(getTheARM64Target());
582 }
125125
126126 extern "C" void LLVMInitializeAArch64Target() {
127127 // Register the target.
128 RegisterTargetMachine X(TheAArch64leTarget);
129 RegisterTargetMachine Y(TheAArch64beTarget);
130 RegisterTargetMachine Z(TheARM64Target);
128 RegisterTargetMachine X(getTheAArch64leTarget());
129 RegisterTargetMachine Y(getTheAArch64beTarget());
130 RegisterTargetMachine Z(getTheARM64Target());
131131 auto PR = PassRegistry::getPassRegistry();
132132 initializeGlobalISel(*PR);
133133 initializeAArch64A53Fix835769Pass(*PR);
45524552
45534553 /// Force static initialization.
45544554 extern "C" void LLVMInitializeAArch64AsmParser() {
4555 RegisterMCAsmParser X(TheAArch64leTarget);
4556 RegisterMCAsmParser Y(TheAArch64beTarget);
4557 RegisterMCAsmParser Z(TheARM64Target);
4555 RegisterMCAsmParser X(getTheAArch64leTarget());
4556 RegisterMCAsmParser Y(getTheAArch64beTarget());
4557 RegisterMCAsmParser Z(getTheARM64Target());
45584558 }
45594559
45604560 #define GET_REGISTER_MATCHER
236236 }
237237
238238 extern "C" void LLVMInitializeAArch64Disassembler() {
239 TargetRegistry::RegisterMCDisassembler(TheAArch64leTarget,
239 TargetRegistry::RegisterMCDisassembler(getTheAArch64leTarget(),
240240 createAArch64Disassembler);
241 TargetRegistry::RegisterMCDisassembler(TheAArch64beTarget,
241 TargetRegistry::RegisterMCDisassembler(getTheAArch64beTarget(),
242242 createAArch64Disassembler);
243 TargetRegistry::RegisterMCSymbolizer(TheAArch64leTarget,
243 TargetRegistry::RegisterMCSymbolizer(getTheAArch64leTarget(),
244244 createAArch64ExternalSymbolizer);
245 TargetRegistry::RegisterMCSymbolizer(TheAArch64beTarget,
245 TargetRegistry::RegisterMCSymbolizer(getTheAArch64beTarget(),
246246 createAArch64ExternalSymbolizer);
247247
248 TargetRegistry::RegisterMCDisassembler(TheARM64Target,
248 TargetRegistry::RegisterMCDisassembler(getTheARM64Target(),
249249 createAArch64Disassembler);
250 TargetRegistry::RegisterMCSymbolizer(TheARM64Target,
250 TargetRegistry::RegisterMCSymbolizer(getTheARM64Target(),
251251 createAArch64ExternalSymbolizer);
252252 }
253253
122122
123123 // Force static initialization.
124124 extern "C" void LLVMInitializeAArch64TargetMC() {
125 for (Target *T :
126 {&TheAArch64leTarget, &TheAArch64beTarget, &TheARM64Target}) {
125 for (Target *T : {&getTheAArch64leTarget(), &getTheAArch64beTarget(),
126 &getTheARM64Target()}) {
127127 // Register the MC asm info.
128128 RegisterMCAsmInfoFn X(*T, createAArch64MCAsmInfo);
129129
161161 }
162162
163163 // Register the asm backend.
164 for (Target *T : {&TheAArch64leTarget, &TheARM64Target})
164 for (Target *T : {&getTheAArch64leTarget(), &getTheARM64Target()})
165165 TargetRegistry::RegisterMCAsmBackend(*T, createAArch64leAsmBackend);
166 TargetRegistry::RegisterMCAsmBackend(TheAArch64beTarget,
166 TargetRegistry::RegisterMCAsmBackend(getTheAArch64beTarget(),
167167 createAArch64beAsmBackend);
168168 }
3434 class raw_ostream;
3535 class raw_pwrite_stream;
3636
37 extern Target TheAArch64leTarget;
38 extern Target TheAArch64beTarget;
39 extern Target TheARM64Target;
37 Target &getTheAArch64leTarget();
38 Target &getTheAArch64beTarget();
39 Target &getTheARM64Target();
4040
4141 MCCodeEmitter *createAArch64MCCodeEmitter(const MCInstrInfo &MCII,
4242 const MCRegisterInfo &MRI,
99 #include "llvm/ADT/Triple.h"
1010 #include "llvm/Support/TargetRegistry.h"
1111 using namespace llvm;
12
1312 namespace llvm {
14 Target TheAArch64leTarget;
15 Target TheAArch64beTarget;
16 Target TheARM64Target;
17 } // end namespace llvm
13 Target &getTheAArch64leTarget() {
14 static Target TheAArch64leTarget;
15 return TheAArch64leTarget;
16 }
17 Target &getTheAArch64beTarget() {
18 static Target TheAArch64beTarget;
19 return TheAArch64beTarget;
20 }
21 Target &getTheARM64Target() {
22 static Target TheARM64Target;
23 return TheARM64Target;
24 }
25 } // namespace llvm
1826
1927 extern "C" void LLVMInitializeAArch64TargetInfo() {
2028 // Now register the "arm64" name for use with "-march". We don't want it to
2129 // take possession of the Triple::aarch64 tag though.
22 TargetRegistry::RegisterTarget(TheARM64Target, "arm64",
30 TargetRegistry::RegisterTarget(getTheARM64Target(), "arm64",
2331 "ARM64 (little endian)",
2432 [](Triple::ArchType) { return false; }, true);
2533
2634 RegisterTarget Z(
27 TheAArch64leTarget, "aarch64", "AArch64 (little endian)");
35 getTheAArch64leTarget(), "aarch64", "AArch64 (little endian)");
2836 RegisterTarget W(
29 TheAArch64beTarget, "aarch64_be", "AArch64 (big endian)");
30
37 getTheAArch64beTarget(), "aarch64_be", "AArch64 (big endian)");
3138 }
107107 void initializeSIInsertWaitsPass(PassRegistry&);
108108 extern char &SIInsertWaitsID;
109109
110 extern Target TheAMDGPUTarget;
111 extern Target TheGCNTarget;
110 Target &getTheAMDGPUTarget();
111 Target &getTheGCNTarget();
112112
113113 namespace AMDGPU {
114114 enum TargetIndex {
8686 }
8787
8888 extern "C" void LLVMInitializeAMDGPUAsmPrinter() {
89 TargetRegistry::RegisterAsmPrinter(TheAMDGPUTarget, createAMDGPUAsmPrinterPass);
90 TargetRegistry::RegisterAsmPrinter(TheGCNTarget, createAMDGPUAsmPrinterPass);
89 TargetRegistry::RegisterAsmPrinter(getTheAMDGPUTarget(),
90 createAMDGPUAsmPrinterPass);
91 TargetRegistry::RegisterAsmPrinter(getTheGCNTarget(),
92 createAMDGPUAsmPrinterPass);
9193 }
9294
9395 AMDGPUAsmPrinter::AMDGPUAsmPrinter(TargetMachine &TM,
6262
6363 extern "C" void LLVMInitializeAMDGPUTarget() {
6464 // Register the target
65 RegisterTargetMachine X(TheAMDGPUTarget);
66 RegisterTargetMachine<GCNTargetMachine> Y(TheGCNTarget);
65 RegisterTargetMachine<R600TargetMachine> X(getTheAMDGPUTarget());
66 RegisterTargetMachine Y(getTheGCNTarget());
6767
6868 PassRegistry *PR = PassRegistry::getPassRegistry();
6969 initializeSILowerI1CopiesPass(*PR);
30513051
30523052 /// Force static initialization.
30533053 extern "C" void LLVMInitializeAMDGPUAsmParser() {
3054 RegisterMCAsmParser A(TheAMDGPUTarget);
3055 RegisterMCAsmParser B(TheGCNTarget);
3054 RegisterMCAsmParser A(getTheAMDGPUTarget());
3055 RegisterMCAsmParser B(getTheGCNTarget());
30563056 }
30573057
30583058 #define GET_REGISTER_MATCHER
494494 }
495495
496496 extern "C" void LLVMInitializeAMDGPUDisassembler() {
497 TargetRegistry::RegisterMCDisassembler(TheGCNTarget, createAMDGPUDisassembler);
498 TargetRegistry::RegisterMCSymbolizer(TheGCNTarget, createAMDGPUSymbolizer);
499 }
497 TargetRegistry::RegisterMCDisassembler(getTheGCNTarget(),
498 createAMDGPUDisassembler);
499 TargetRegistry::RegisterMCSymbolizer(getTheGCNTarget(),
500 createAMDGPUSymbolizer);
501 }
8585 }
8686
8787 extern "C" void LLVMInitializeAMDGPUTargetMC() {
88 for (Target *T : {&TheAMDGPUTarget, &TheGCNTarget}) {
88 for (Target *T : {&getTheAMDGPUTarget(), &getTheGCNTarget()}) {
8989 RegisterMCAsmInfo X(*T);
9090
9191 TargetRegistry::RegisterMCInstrInfo(*T, createAMDGPUMCInstrInfo);
9797 }
9898
9999 // R600 specific registration
100 TargetRegistry::RegisterMCCodeEmitter(TheAMDGPUTarget,
100 TargetRegistry::RegisterMCCodeEmitter(getTheAMDGPUTarget(),
101101 createR600MCCodeEmitter);
102102
103103 // GCN specific registration
104 TargetRegistry::RegisterMCCodeEmitter(TheGCNTarget, createSIMCCodeEmitter);
104 TargetRegistry::RegisterMCCodeEmitter(getTheGCNTarget(),
105 createSIMCCodeEmitter);
105106
106 TargetRegistry::RegisterAsmTargetStreamer(TheGCNTarget,
107 TargetRegistry::RegisterAsmTargetStreamer(getTheGCNTarget(),
107108 createAMDGPUAsmTargetStreamer);
108 TargetRegistry::RegisterObjectTargetStreamer(TheGCNTarget,
109 createAMDGPUObjectTargetStreamer);
109 TargetRegistry::RegisterObjectTargetStreamer(
110 getTheGCNTarget(), createAMDGPUObjectTargetStreamer);
110111 }
3131 class Triple;
3232 class raw_pwrite_stream;
3333
34 extern Target TheAMDGPUTarget;
35 extern Target TheGCNTarget;
34 Target &getTheAMDGPUTarget();
35 Target &getTheGCNTarget();
3636
3737 MCCodeEmitter *createR600MCCodeEmitter(const MCInstrInfo &MCII,
3838 const MCRegisterInfo &MRI,
1717
1818 /// \brief The target which suports all AMD GPUs. This will eventually
1919 /// be deprecated and there will be a R600 target and a GCN target.
20 Target llvm::TheAMDGPUTarget;
20 Target &llvm::getTheAMDGPUTarget() {
21 static Target TheAMDGPUTarget;
22 return TheAMDGPUTarget;
23 }
2124 /// \brief The target for GCN GPUs
22 Target llvm::TheGCNTarget;
25 Target &llvm::getTheGCNTarget() {
26 static Target TheGCNTarget;
27 return TheGCNTarget;
28 }
2329
2430 /// \brief Extern function to initialize the targets for the AMDGPU backend
2531 extern "C" void LLVMInitializeAMDGPUTargetInfo() {
26 RegisterTarget
27 R600(TheAMDGPUTarget, "r600", "AMD GPUs HD2XXX-HD6XXX");
28 RegisterTargetamdgcn, false> GCN(TheGCNTarget, "amdgcn", "AMD GCN GPUs");
32 RegisterTargetr600, false> R600(getTheAMDGPUTarget(), "r600",
33 "AMD GPUs HD2XXX-HD6XXX");
34 RegisterTarget GCN(getTheGCNTarget(), "amdgcn",
35 "AMD GCN GPUs");
2936 }
20632063
20642064 // Force static initialization.
20652065 extern "C" void LLVMInitializeARMAsmPrinter() {
2066 RegisterAsmPrinter X(TheARMLETarget);
2067 RegisterAsmPrinter Y(TheARMBETarget);
2068 RegisterAsmPrinter A(TheThumbLETarget);
2069 RegisterAsmPrinter B(TheThumbBETarget);
2070 }
2066 RegisterAsmPrinter X(getTheARMLETarget());
2067 RegisterAsmPrinter Y(getTheARMBETarget());
2068 RegisterAsmPrinter A(getTheThumbLETarget());
2069 RegisterAsmPrinter B(getTheThumbBETarget());
2070 }
5050
5151 extern "C" void LLVMInitializeARMTarget() {
5252 // Register the target.
53 RegisterTargetMachine X(TheARMLETarget);
54 RegisterTargetMachine Y(TheARMBETarget);
55 RegisterTargetMachine A(TheThumbLETarget);
56 RegisterTargetMachine<ThumbBETargetMachine> B(TheThumbBETarget);
53 RegisterTargetMachine<ARMLETargetMachine> X(getTheARMLETarget());
54 RegisterTargetMachine Y(getTheARMBETarget());
55 RegisterTargetMachine A(getTheThumbLETarget());
56 RegisterTargetMachine B(getTheThumbBETarget());
5757
5858 PassRegistry &Registry = *PassRegistry::getPassRegistry();
5959 initializeARMLoadStoreOptPass(Registry);
1040710407
1040810408 /// Force static initialization.
1040910409 extern "C" void LLVMInitializeARMAsmParser() {
10410 RegisterMCAsmParser X(TheARMLETarget);
10411 RegisterMCAsmParser Y(TheARMBETarget);
10412 RegisterMCAsmParser A(TheThumbLETarget);
10413 RegisterMCAsmParser B(TheThumbBETarget);
10410 RegisterMCAsmParser X(getTheARMLETarget());
10411 RegisterMCAsmParser Y(getTheARMBETarget());
10412 RegisterMCAsmParser A(getTheThumbLETarget());
10413 RegisterMCAsmParser B(getTheThumbBETarget());
1041410414 }
1041510415
1041610416 #define GET_REGISTER_MATCHER
860860
861861
862862 extern "C" void LLVMInitializeARMDisassembler() {
863 TargetRegistry::RegisterMCDisassembler(TheARMLETarget,
863 TargetRegistry::RegisterMCDisassembler(getTheARMLETarget(),
864864 createARMDisassembler);
865 TargetRegistry::RegisterMCDisassembler(TheARMBETarget,
865 TargetRegistry::RegisterMCDisassembler(getTheARMBETarget(),
866866 createARMDisassembler);
867 TargetRegistry::RegisterMCDisassembler(TheThumbLETarget,
867 TargetRegistry::RegisterMCDisassembler(getTheThumbLETarget(),
868868 createThumbDisassembler);
869 TargetRegistry::RegisterMCDisassembler(TheThumbBETarget,
869 TargetRegistry::RegisterMCDisassembler(getTheThumbBETarget(),
870870 createThumbDisassembler);
871871 }
872872
273273
274274 // Force static initialization.
275275 extern "C" void LLVMInitializeARMTargetMC() {
276 for (Target *T : {&TheARMLETarget, &TheARMBETarget, &TheThumbLETarget,
277 &TheThumbBETarget}) {
276 for (Target *T : {&getTheARMLETarget(), &getTheARMBETarget(),
277 &getTheThumbLETarget(), &getTheThumbBETarget()}) {
278278 // Register the MC asm info.
279279 RegisterMCAsmInfoFn X(*T, createARMMCAsmInfo);
280280
313313 }
314314
315315 // Register the MC Code Emitter
316 for (Target *T : {&TheARMLETarget, &TheThumbLETarget})
316 for (Target *T : {&getTheARMLETarget(), &getTheThumbLETarget()})
317317 TargetRegistry::RegisterMCCodeEmitter(*T, createARMLEMCCodeEmitter);
318 for (Target *T : {&TheARMBETarget, &TheThumbBETarget})
318 for (Target *T : {&getTheARMBETarget(), &getTheThumbBETarget()})
319319 TargetRegistry::RegisterMCCodeEmitter(*T, createARMBEMCCodeEmitter);
320320
321321 // Register the asm backend.
322 TargetRegistry::RegisterMCAsmBackend(TheARMLETarget, createARMLEAsmBackend);
323 TargetRegistry::RegisterMCAsmBackend(TheARMBETarget, createARMBEAsmBackend);
324 TargetRegistry::RegisterMCAsmBackend(TheThumbLETarget,
322 TargetRegistry::RegisterMCAsmBackend(getTheARMLETarget(),
323 createARMLEAsmBackend);
324 TargetRegistry::RegisterMCAsmBackend(getTheARMBETarget(),
325 createARMBEAsmBackend);
326 TargetRegistry::RegisterMCAsmBackend(getTheThumbLETarget(),
325327 createThumbLEAsmBackend);
326 TargetRegistry::RegisterMCAsmBackend(TheThumbBETarget,
328 TargetRegistry::RegisterMCAsmBackend(getTheThumbBETarget(),
327329 createThumbBEAsmBackend);
328330 }
3636 class raw_ostream;
3737 class raw_pwrite_stream;
3838
39 extern Target TheARMLETarget, TheThumbLETarget;
40 extern Target TheARMBETarget, TheThumbBETarget;
39 Target &getTheARMLETarget();
40 Target &getTheThumbLETarget();
41 Target &getTheARMBETarget();
42 Target &getTheThumbBETarget();
4143
4244 namespace ARM_MC {
4345 std::string ParseARMTriple(const Triple &TT, StringRef CPU);
1010 #include "llvm/Support/TargetRegistry.h"
1111 using namespace llvm;
1212
13 Target llvm::TheARMLETarget, llvm::TheARMBETarget;
14 Target llvm::TheThumbLETarget, llvm::TheThumbBETarget;
13 Target &llvm::getTheARMLETarget() {
14 static Target TheARMLETarget;
15 return TheARMLETarget;
16 }
17 Target &llvm::getTheARMBETarget() {
18 static Target TheARMBETarget;
19 return TheARMBETarget;
20 }
21 Target &llvm::getTheThumbLETarget() {
22 static Target TheThumbLETarget;
23 return TheThumbLETarget;
24 }
25 Target &llvm::getTheThumbBETarget() {
26 static Target TheThumbBETarget;
27 return TheThumbBETarget;
28 }
1529
1630 extern "C" void LLVMInitializeARMTargetInfo() {
17 RegisterTarget
18 X(TheARMLETarget, "arm", "ARM");
19 RegisterTarget
20 Y(TheARMBETarget, "armeb", "ARM (big endian)");
31 RegisterTarget X(getTheARMLETarget(), "arm",
32 "ARM");
33 RegisterTarget Y(getTheARMBETarget(), "armeb",
34 "ARM (big endian)");
2135
22 RegisterTarget
23 A(TheThumbLETarget, "thumb", "Thumb");
24 RegisterTarget
25 B(TheThumbBETarget, "thumbeb", "Thumb (big endian)");
36 RegisterTarget A(getTheThumbLETarget(),
37 "thumb", "Thumb");
38 RegisterTarget B(
39 getTheThumbBETarget(), "thumbeb", "Thumb (big endian)");
2640 }
176176 } // end of namespace llvm
177177
178178 extern "C" void LLVMInitializeAVRAsmPrinter() {
179 llvm::RegisterAsmPrinter X(llvm::TheAVRTarget);
179 llvm::RegisterAsmPrinter X(llvm::getTheAVRTarget());
180180 }
181181
7676
7777 extern "C" void LLVMInitializeAVRTarget() {
7878 // Register the target.
79 RegisterTargetMachine X(TheAVRTarget);
79 RegisterTargetMachine X(getTheAVRTarget());
8080 }
8181
8282 const AVRSubtarget *AVRTargetMachine::getSubtargetImpl() const {
581581 bool AVRAsmParser::ParseDirective(llvm::AsmToken DirectiveID) { return true; }
582582
583583 extern "C" void LLVMInitializeAVRAsmParser() {
584 RegisterMCAsmParser X(TheAVRTarget);
584 RegisterMCAsmParser X(getTheAVRTarget());
585585 }
586586
587587 #define GET_REGISTER_MATCHER
8484
8585 extern "C" void LLVMInitializeAVRTargetMC() {
8686 // Register the MC asm info.
87 RegisterMCAsmInfo X(TheAVRTarget);
87 RegisterMCAsmInfo X(getTheAVRTarget());
8888
8989 // Register the MC instruction info.
90 TargetRegistry::RegisterMCInstrInfo(TheAVRTarget, createAVRMCInstrInfo);
90 TargetRegistry::RegisterMCInstrInfo(getTheAVRTarget(), createAVRMCInstrInfo);
9191
9292 // Register the MC register info.
93 TargetRegistry::RegisterMCRegInfo(TheAVRTarget, createAVRMCRegisterInfo);
93 TargetRegistry::RegisterMCRegInfo(getTheAVRTarget(), createAVRMCRegisterInfo);
9494
9595 // Register the MC subtarget info.
96 TargetRegistry::RegisterMCSubtargetInfo(TheAVRTarget,
96 TargetRegistry::RegisterMCSubtargetInfo(getTheAVRTarget(),
9797 createAVRMCSubtargetInfo);
9898
9999 // Register the MCInstPrinter.
100 TargetRegistry::RegisterMCInstPrinter(TheAVRTarget, createAVRMCInstPrinter);
100 TargetRegistry::RegisterMCInstPrinter(getTheAVRTarget(),
101 createAVRMCInstPrinter);
101102
102103 // Register the ELF streamer
103 TargetRegistry::RegisterELFStreamer(TheAVRTarget, createMCStreamer);
104 TargetRegistry::RegisterELFStreamer(getTheAVRTarget(), createMCStreamer);
104105
105106 // Register the obj target streamer.
106 TargetRegistry::RegisterObjectTargetStreamer(TheAVRTarget,
107 TargetRegistry::RegisterObjectTargetStreamer(getTheAVRTarget(),
107108 createAVRObjectTargetStreamer);
108109
109110 // Register the asm target streamer.
110 TargetRegistry::RegisterAsmTargetStreamer(TheAVRTarget,
111 TargetRegistry::RegisterAsmTargetStreamer(getTheAVRTarget(),
111112 createMCAsmTargetStreamer);
112113
113114 // Register the asm backend (as little endian).
114 TargetRegistry::RegisterMCAsmBackend(TheAVRTarget, createAVRAsmBackend);
115 TargetRegistry::RegisterMCAsmBackend(getTheAVRTarget(), createAVRAsmBackend);
115116 }
116117
2929 class Triple;
3030 class raw_pwrite_stream;
3131
32 extern Target TheAVRTarget;
32 Target &getTheAVRTarget();
3333
3434 /// Creates a machine code emitter for AVR.
3535 MCCodeEmitter *createAVRMCCodeEmitter(const MCInstrInfo &MCII,
88
99 #include "llvm/IR/Module.h"
1010 #include "llvm/Support/TargetRegistry.h"
11
1211 namespace llvm {
13 Target TheAVRTarget;
12 Target &getTheAVRTarget() {
13 static Target TheAVRTarget;
14 return TheAVRTarget;
15 }
1416 }
1517
1618 extern "C" void LLVMInitializeAVRTargetInfo() {
17 llvm::RegisterTarget X(
18 llvm::TheAVRTarget, "avr", "Atmel AVR Microcontroller");
19 llvm::RegisterTarget X(llvm::getTheAVRTarget(), "avr",
20 "Atmel AVR Microcontroller");
1921 }
2022
5454
5555 // Force static initialization.
5656 extern "C" void LLVMInitializeBPFAsmPrinter() {
57 RegisterAsmPrinter X(TheBPFleTarget);
58 RegisterAsmPrinter Y(TheBPFbeTarget);
59 RegisterAsmPrinter Z(TheBPFTarget);
57 RegisterAsmPrinter X(getTheBPFleTarget());
58 RegisterAsmPrinter Y(getTheBPFbeTarget());
59 RegisterAsmPrinter Z(getTheBPFTarget());
6060 }
2323
2424 extern "C" void LLVMInitializeBPFTarget() {
2525 // Register the target.
26 RegisterTargetMachine X(TheBPFleTarget);
27 RegisterTargetMachine Y(TheBPFbeTarget);
28 RegisterTargetMachine Z(TheBPFTarget);
26 RegisterTargetMachine X(getTheBPFleTarget());
27 RegisterTargetMachine Y(getTheBPFbeTarget());
28 RegisterTargetMachine Z(getTheBPFTarget());
2929 }
3030
3131 // DataLayout: little or big endian
6767 }
6868
6969 extern "C" void LLVMInitializeBPFTargetMC() {
70 for (Target *T : {&TheBPFleTarget, &TheBPFbeTarget, &TheBPFTarget}) {
70 for (Target *T :
71 {&getTheBPFleTarget(), &getTheBPFbeTarget(), &getTheBPFTarget()}) {
7172 // Register the MC asm info.
7273 RegisterMCAsmInfo X(*T);
7374
8990 }
9091
9192 // Register the MC code emitter
92 TargetRegistry::RegisterMCCodeEmitter(TheBPFleTarget, createBPFMCCodeEmitter);
93 TargetRegistry::RegisterMCCodeEmitter(TheBPFbeTarget, createBPFbeMCCodeEmitter);
93 TargetRegistry::RegisterMCCodeEmitter(getTheBPFleTarget(),
94 createBPFMCCodeEmitter);
95 TargetRegistry::RegisterMCCodeEmitter(getTheBPFbeTarget(),
96 createBPFbeMCCodeEmitter);
9497
9598 // Register the ASM Backend
96 TargetRegistry::RegisterMCAsmBackend(TheBPFleTarget, createBPFAsmBackend);
97 TargetRegistry::RegisterMCAsmBackend(TheBPFbeTarget, createBPFbeAsmBackend);
99 TargetRegistry::RegisterMCAsmBackend(getTheBPFleTarget(),
100 createBPFAsmBackend);
101 TargetRegistry::RegisterMCAsmBackend(getTheBPFbeTarget(),
102 createBPFbeAsmBackend);
98103
99104 if (sys::IsLittleEndianHost) {
100 TargetRegistry::RegisterMCCodeEmitter(TheBPFTarget, createBPFMCCodeEmitter);
101 TargetRegistry::RegisterMCAsmBackend(TheBPFTarget, createBPFAsmBackend);
105 TargetRegistry::RegisterMCCodeEmitter(getTheBPFTarget(),
106 createBPFMCCodeEmitter);
107 TargetRegistry::RegisterMCAsmBackend(getTheBPFTarget(),
108 createBPFAsmBackend);
102109 } else {
103 TargetRegistry::RegisterMCCodeEmitter(TheBPFTarget, createBPFbeMCCodeEmitter);
104 TargetRegistry::RegisterMCAsmBackend(TheBPFTarget, createBPFbeAsmBackend);
110 TargetRegistry::RegisterMCCodeEmitter(getTheBPFTarget(),
111 createBPFbeMCCodeEmitter);
112 TargetRegistry::RegisterMCAsmBackend(getTheBPFTarget(),
113 createBPFbeAsmBackend);
105114 }
106115 }
3131 class raw_ostream;
3232 class raw_pwrite_stream;
3333
34 extern Target TheBPFleTarget;
35 extern Target TheBPFbeTarget;
36 extern Target TheBPFTarget;
34 Target &getTheBPFleTarget();
35 Target &getTheBPFbeTarget();
36 Target &getTheBPFTarget();
3737
3838 MCCodeEmitter *createBPFMCCodeEmitter(const MCInstrInfo &MCII,
3939 const MCRegisterInfo &MRI,
1111 using namespace llvm;
1212
1313 namespace llvm {
14 Target TheBPFleTarget;
15 Target TheBPFbeTarget;
16 Target TheBPFTarget;
14 Target &getTheBPFleTarget() {
15 static Target TheBPFleTarget;
16 return TheBPFleTarget;
1717 }
18 Target &getTheBPFbeTarget() {
19 static Target TheBPFbeTarget;
20 return TheBPFbeTarget;
21 }
22 Target &getTheBPFTarget() {
23 static Target TheBPFTarget;
24 return TheBPFTarget;
25 }
26 } // namespace llvm
1827
1928 extern "C" void LLVMInitializeBPFTargetInfo() {
20 TargetRegistry::RegisterTarget(TheBPFTarget, "bpf",
21 "BPF (host endian)",
29 TargetRegistry::RegisterTarget(getTheBPFTarget(), "bpf", "BPF (host endian)",
2230 [](Triple::ArchType) { return false; }, true);
23 RegisterTarget X(
24 TheBPFleTarget, "bpfel", "BPF (little endian)");
25 RegisterTarget Y(
26 TheBPFbeTarget, "bpfeb", "BPF (big endian)");
31 RegisterTarget X(getTheBPFleTarget(), "bpfel",
32 "BPF (little endian)");
33 RegisterTarget Y(getTheBPFbeTarget(), "bpfeb",
34 "BPF (big endian)");
2735 }
10641064
10651065 /// Force static initialization.
10661066 extern "C" void LLVMInitializeHexagonAsmParser() {
1067 RegisterMCAsmParser X(TheHexagonTarget);
1067 RegisterMCAsmParser X(getTheHexagonTarget());
10681068 }
10691069
10701070 #define GET_MATCHER_IMPLEMENTATION
146146 }
147147
148148 extern "C" void LLVMInitializeHexagonDisassembler() {
149 TargetRegistry::RegisterMCDisassembler(TheHexagonTarget,
149 TargetRegistry::RegisterMCDisassembler(getTheHexagonTarget(),
150150 createHexagonDisassembler);
151151 }
152152
599599 }
600600
601601 extern "C" void LLVMInitializeHexagonAsmPrinter() {
602 RegisterAsmPrinter X(TheHexagonTarget);
603 }
602 RegisterAsmPrinter X(getTheHexagonTarget());
603 }
9999
100100 extern "C" void LLVMInitializeHexagonTarget() {
101101 // Register the target.
102 RegisterTargetMachine X(TheHexagonTarget);
102 RegisterTargetMachine X(getTheHexagonTarget());
103103 }
104104
105105 static ScheduleDAGInstrs *createVLIWMachineSched(MachineSchedContext *C) {
229229 // Force static initialization.
230230 extern "C" void LLVMInitializeHexagonTargetMC() {
231231 // Register the MC asm info.
232 RegisterMCAsmInfoFn X(TheHexagonTarget, createHexagonMCAsmInfo);
232 RegisterMCAsmInfoFn X(getTheHexagonTarget(), createHexagonMCAsmInfo);
233233
234234 // Register the MC instruction info.
235 TargetRegistry::RegisterMCInstrInfo(TheHexagonTarget,
235 TargetRegistry::RegisterMCInstrInfo(getTheHexagonTarget(),
236236 createHexagonMCInstrInfo);
237237
238238 // Register the MC register info.
239 TargetRegistry::RegisterMCRegInfo(TheHexagonTarget,
239 TargetRegistry::RegisterMCRegInfo(getTheHexagonTarget(),
240240 createHexagonMCRegisterInfo);
241241
242242 // Register the MC subtarget info.
243 TargetRegistry::RegisterMCSubtargetInfo(TheHexagonTarget,
243 TargetRegistry::RegisterMCSubtargetInfo(getTheHexagonTarget(),
244244 createHexagonMCSubtargetInfo);
245245
246246 // Register the MC Code Emitter
247 TargetRegistry::RegisterMCCodeEmitter(TheHexagonTarget,
247 TargetRegistry::RegisterMCCodeEmitter(getTheHexagonTarget(),
248248 createHexagonMCCodeEmitter);
249249
250250 // Register the asm backend
251 TargetRegistry::RegisterMCAsmBackend(TheHexagonTarget,
251 TargetRegistry::RegisterMCAsmBackend(getTheHexagonTarget(),
252252 createHexagonAsmBackend);
253253
254254 // Register the obj streamer
255 TargetRegistry::RegisterELFStreamer(TheHexagonTarget, createMCStreamer);
255 TargetRegistry::RegisterELFStreamer(getTheHexagonTarget(), createMCStreamer);
256256
257257 // Register the asm streamer
258 TargetRegistry::RegisterAsmTargetStreamer(TheHexagonTarget,
258 TargetRegistry::RegisterAsmTargetStreamer(getTheHexagonTarget(),
259259 createMCAsmTargetStreamer);
260260
261261 // Register the MC Inst Printer
262 TargetRegistry::RegisterMCInstPrinter(TheHexagonTarget,
262 TargetRegistry::RegisterMCInstPrinter(getTheHexagonTarget(),
263263 createHexagonMCInstPrinter);
264264
265265 TargetRegistry::RegisterObjectTargetStreamer(
266 TheHexagonTarget, createHexagonObjectTargetStreamer);
267 }
266 getTheHexagonTarget(), createHexagonObjectTargetStreamer);
267 }
3434 class raw_ostream;
3535 class raw_pwrite_stream;
3636
37 extern Target TheHexagonTarget;
37 Target &getTheHexagonTarget();
3838 extern cl::opt HexagonDisableCompound;
3939 extern cl::opt HexagonDisableDuplex;
4040 extern const InstrStage HexagonStages[];
1111 #include "llvm/Support/TargetRegistry.h"
1212 using namespace llvm;
1313
14 Target llvm::TheHexagonTarget;
14 Target &llvm::getTheHexagonTarget() {
15 static Target TheHexagonTarget;
16 return TheHexagonTarget;
17 }
1518
1619 extern "C" void LLVMInitializeHexagonTargetInfo() {
17 RegisterTarget X(TheHexagonTarget, "hexagon", "Hexagon");
20 RegisterTarget X(getTheHexagonTarget(),
21 "hexagon", "Hexagon");
1822 }
12061206 } // namespace
12071207
12081208 extern "C" void LLVMInitializeLanaiAsmParser() {
1209 RegisterMCAsmParser x(TheLanaiTarget);
1209 RegisterMCAsmParser x(getTheLanaiTarget());
12101210 }
12111211
12121212 } // namespace llvm
2626 typedef MCDisassembler::DecodeStatus DecodeStatus;
2727
2828 namespace llvm {
29 extern Target TheLanaiTarget;
29 Target &getTheLanaiTarget();
3030 }
3131
3232 static MCDisassembler *createLanaiDisassembler(const Target & /*T*/,
3737
3838 extern "C" void LLVMInitializeLanaiDisassembler() {
3939 // Register the disassembler
40 TargetRegistry::RegisterMCDisassembler(TheLanaiTarget,
40 TargetRegistry::RegisterMCDisassembler(getTheLanaiTarget(),
4141 createLanaiDisassembler);
4242 }
4343
4444 // operations.
4545 FunctionPass *createLanaiSetflagAluCombinerPass();
4646
47 extern Target TheLanaiTarget;
47 Target &getTheLanaiTarget();
4848 } // namespace llvm
4949
5050 #endif // LLVM_LIB_TARGET_LANAI_LANAI_H
238238
239239 // Force static initialization.
240240 extern "C" void LLVMInitializeLanaiAsmPrinter() {
241 RegisterAsmPrinter X(TheLanaiTarget);
242 }
241 RegisterAsmPrinter X(getTheLanaiTarget());
242 }
3131
3232 extern "C" void LLVMInitializeLanaiTarget() {
3333 // Register the target.
34 RegisterTargetMachine registered_target(TheLanaiTarget);
34 RegisterTargetMachine registered_target(
35 getTheLanaiTarget());
3536 }
3637
3738 static std::string computeDataLayout() {
112112
113113 extern "C" void LLVMInitializeLanaiTargetMC() {
114114 // Register the MC asm info.
115 RegisterMCAsmInfo X(TheLanaiTarget);
115 RegisterMCAsmInfo X(getTheLanaiTarget());
116116
117117 // Register the MC instruction info.
118 TargetRegistry::RegisterMCInstrInfo(TheLanaiTarget, createLanaiMCInstrInfo);
118 TargetRegistry::RegisterMCInstrInfo(getTheLanaiTarget(),
119 createLanaiMCInstrInfo);
119120
120121 // Register the MC register info.
121 TargetRegistry::RegisterMCRegInfo(TheLanaiTarget, createLanaiMCRegisterInfo);
122 TargetRegistry::RegisterMCRegInfo(getTheLanaiTarget(),
123 createLanaiMCRegisterInfo);
122124
123125 // Register the MC subtarget info.
124 TargetRegistry::RegisterMCSubtargetInfo(TheLanaiTarget,
126 TargetRegistry::RegisterMCSubtargetInfo(getTheLanaiTarget(),
125127 createLanaiMCSubtargetInfo);
126128
127129 // Register the MC code emitter
128 TargetRegistry::RegisterMCCodeEmitter(TheLanaiTarget,
130 TargetRegistry::RegisterMCCodeEmitter(getTheLanaiTarget(),
129131 llvm::createLanaiMCCodeEmitter);
130132
131133 // Register the ASM Backend
132 TargetRegistry::RegisterMCAsmBackend(TheLanaiTarget, createLanaiAsmBackend);
134 TargetRegistry::RegisterMCAsmBackend(getTheLanaiTarget(),
135 createLanaiAsmBackend);
133136
134137 // Register the MCInstPrinter.
135 TargetRegistry::RegisterMCInstPrinter(TheLanaiTarget,
138 TargetRegistry::RegisterMCInstPrinter(getTheLanaiTarget(),
136139 createLanaiMCInstPrinter);
137140
138141 // Register the ELF streamer.
139 TargetRegistry::RegisterELFStreamer(TheLanaiTarget, createMCStreamer);
142 TargetRegistry::RegisterELFStreamer(getTheLanaiTarget(), createMCStreamer);
140143
141144 // Register the MC relocation info.
142 TargetRegistry::RegisterMCRelocationInfo(TheLanaiTarget,
145 TargetRegistry::RegisterMCRelocationInfo(getTheLanaiTarget(),
143146 createLanaiElfRelocation);
144147
145148 // Register the MC instruction analyzer.
146 TargetRegistry::RegisterMCInstrAnalysis(TheLanaiTarget,
149 TargetRegistry::RegisterMCInstrAnalysis(getTheLanaiTarget(),
147150 createLanaiInstrAnalysis);
148151 }
3131 class StringRef;
3232 class raw_pwrite_stream;
3333
34 extern Target TheLanaiTarget;
34 Target &getTheLanaiTarget();
3535
3636 MCCodeEmitter *createLanaiMCCodeEmitter(const MCInstrInfo &MCII,
3737 const MCRegisterInfo &MRI,
1212
1313 using namespace llvm;
1414
15 Target llvm::TheLanaiTarget;
15 namespace llvm {
16 Target &getTheLanaiTarget() {
17 static Target TheLanaiTarget;
18 return TheLanaiTarget;
19 }
20 } // namespace llvm
1621
1722 extern "C" void LLVMInitializeLanaiTargetInfo() {
18 RegisterTarget X(TheLanaiTarget, "lanai", "Lanai");
23 RegisterTarget X(getTheLanaiTarget(), "lanai", "Lanai");
1924 }
5858
5959 extern "C" void LLVMInitializeMSP430TargetMC() {
6060 // Register the MC asm info.
61 RegisterMCAsmInfo X(TheMSP430Target);
61 RegisterMCAsmInfo X(getTheMSP430Target());
6262
6363 // Register the MC instruction info.
64 TargetRegistry::RegisterMCInstrInfo(TheMSP430Target, createMSP430MCInstrInfo);
64 TargetRegistry::RegisterMCInstrInfo(getTheMSP430Target(),
65 createMSP430MCInstrInfo);
6566
6667 // Register the MC register info.
67 TargetRegistry::RegisterMCRegInfo(TheMSP430Target,
68 TargetRegistry::RegisterMCRegInfo(getTheMSP430Target(),
6869 createMSP430MCRegisterInfo);
6970
7071 // Register the MC subtarget info.
71 TargetRegistry::RegisterMCSubtargetInfo(TheMSP430Target,
72 TargetRegistry::RegisterMCSubtargetInfo(getTheMSP430Target(),
7273 createMSP430MCSubtargetInfo);
7374
7475 // Register the MCInstPrinter.
75 TargetRegistry::RegisterMCInstPrinter(TheMSP430Target,
76 TargetRegistry::RegisterMCInstPrinter(getTheMSP430Target(),
7677 createMSP430MCInstPrinter);
7778 }
1818 namespace llvm {
1919 class Target;
2020
21 extern Target TheMSP430Target;
21 Target &getTheMSP430Target();
2222
2323 } // End llvm namespace
2424
154154
155155 // Force static initialization.
156156 extern "C" void LLVMInitializeMSP430AsmPrinter() {
157 RegisterAsmPrinter X(TheMSP430Target);
157 RegisterAsmPrinter X(getTheMSP430Target());
158158 }
2222
2323 extern "C" void LLVMInitializeMSP430Target() {
2424 // Register the target.
25 RegisterTargetMachine X(TheMSP430Target);
25 RegisterTargetMachine X(getTheMSP430Target());
2626 }
2727
2828 static Reloc::Model getEffectiveRelocModel(Optional RM) {
1111 #include "llvm/Support/TargetRegistry.h"
1212 using namespace llvm;
1313
14 Target llvm::TheMSP430Target;
14 Target &llvm::getTheMSP430Target() {
15 static Target TheMSP430Target;
16 return TheMSP430Target;
17 }
1518
16 extern "C" void LLVMInitializeMSP430TargetInfo() {
17 RegisterTarget
18 X(TheMSP430Target, "msp430", "MSP430 [experimental]");
19 extern "C" void LLVMInitializeMSP430TargetInfo() {
20 RegisterTarget X(getTheMSP430Target(), "msp430",
21 "MSP430 [experimental]");
1922 }
64686468 }
64696469
64706470 extern "C" void LLVMInitializeMipsAsmParser() {
6471 RegisterMCAsmParser X(TheMipsTarget);
6472 RegisterMCAsmParser Y(TheMipselTarget);
6473 RegisterMCAsmParser A(TheMips64Target);
6474 RegisterMCAsmParser B(TheMips64elTarget);
6471 RegisterMCAsmParser X(getTheMipsTarget());
6472 RegisterMCAsmParser Y(getTheMipselTarget());
6473 RegisterMCAsmParser A(getTheMips64Target());
6474 RegisterMCAsmParser B(getTheMips64elTarget());
64756475 }
64766476
64776477 #define GET_REGISTER_MATCHER
518518 const void *Decoder);
519519
520520 namespace llvm {
521 extern Target TheMipselTarget, TheMipsTarget, TheMips64Target,
522 TheMips64elTarget;
521 Target &getTheMipselTarget();
522 Target &getTheMipsTarget();
523 Target &getTheMips64Target();
524 Target &getTheMips64elTarget();
523525 }
524526
525527 static MCDisassembler *createMipsDisassembler(
538540
539541 extern "C" void LLVMInitializeMipsDisassembler() {
540542 // Register the disassembler.
541 TargetRegistry::RegisterMCDisassembler(TheMipsTarget,
543 TargetRegistry::RegisterMCDisassembler(getTheMipsTarget(),
542544 createMipsDisassembler);
543 TargetRegistry::RegisterMCDisassembler(TheMipselTarget,
545 TargetRegistry::RegisterMCDisassembler(getTheMipselTarget(),
544546 createMipselDisassembler);
545 TargetRegistry::RegisterMCDisassembler(TheMips64Target,
547 TargetRegistry::RegisterMCDisassembler(getTheMips64Target(),
546548 createMipsDisassembler);
547 TargetRegistry::RegisterMCDisassembler(TheMips64elTarget,
549 TargetRegistry::RegisterMCDisassembler(getTheMips64elTarget(),
548550 createMipselDisassembler);
549551 }
550552
148148 }
149149
150150 extern "C" void LLVMInitializeMipsTargetMC() {
151 for (Target *T : {&TheMipsTarget, &TheMipselTarget, &TheMips64Target,
152 &TheMips64elTarget}) {
151 for (Target *T : {&getTheMipsTarget(), &getTheMipselTarget(),
152 &getTheMips64Target(), &getTheMips64elTarget()}) {
153153 // Register the MC asm info.
154154 RegisterMCAsmInfoFn X(*T, createMipsMCAsmInfo);
155155
182182 }
183183
184184 // Register the MC Code Emitter
185 for (Target *T : {&TheMipsTarget, &TheMips64Target})
185 for (Target *T : {&getTheMipsTarget(), &getTheMips64Target()})
186186 TargetRegistry::RegisterMCCodeEmitter(*T, createMipsMCCodeEmitterEB);
187187
188 for (Target *T : {&TheMipselTarget, &TheMips64elTarget})
188 for (Target *T : {&getTheMipselTarget(), &getTheMips64elTarget()})
189189 TargetRegistry::RegisterMCCodeEmitter(*T, createMipsMCCodeEmitterEL);
190190
191191 // Register the asm backend.
192 TargetRegistry::RegisterMCAsmBackend(TheMipsTarget,
192 TargetRegistry::RegisterMCAsmBackend(getTheMipsTarget(),
193193 createMipsAsmBackendEB32);
194 TargetRegistry::RegisterMCAsmBackend(TheMipselTarget,
194 TargetRegistry::RegisterMCAsmBackend(getTheMipselTarget(),
195195 createMipsAsmBackendEL32);
196 TargetRegistry::RegisterMCAsmBackend(TheMips64Target,
196 TargetRegistry::RegisterMCAsmBackend(getTheMips64Target(),
197197 createMipsAsmBackendEB64);
198 TargetRegistry::RegisterMCAsmBackend(TheMips64elTarget,
198 TargetRegistry::RegisterMCAsmBackend(getTheMips64elTarget(),
199199 createMipsAsmBackendEL64);
200
201 }
200 }
3030 class raw_ostream;
3131 class raw_pwrite_stream;
3232
33 extern Target TheMipsTarget;
34 extern Target TheMipselTarget;
35 extern Target TheMips64Target;
36 extern Target TheMips64elTarget;
33 Target &getTheMipsTarget();
34 Target &getTheMipselTarget();
35 Target &getTheMips64Target();
36 Target &getTheMips64elTarget();
3737
3838 MCCodeEmitter *createMipsMCCodeEmitterEB(const MCInstrInfo &MCII,
3939 const MCRegisterInfo &MRI,
10651065
10661066 // Force static initialization.
10671067 extern "C" void LLVMInitializeMipsAsmPrinter() {
1068 RegisterAsmPrinter X(TheMipsTarget);
1069 RegisterAsmPrinter Y(TheMipselTarget);
1070 RegisterAsmPrinter A(TheMips64Target);
1071 RegisterAsmPrinter B(TheMips64elTarget);
1072 }
1068 RegisterAsmPrinter X(getTheMipsTarget());
1069 RegisterAsmPrinter Y(getTheMipselTarget());
1070 RegisterAsmPrinter A(getTheMips64Target());
1071 RegisterAsmPrinter B(getTheMips64elTarget());
1072 }
3838
3939 extern "C" void LLVMInitializeMipsTarget() {
4040 // Register the target.
41 RegisterTargetMachine X(TheMipsTarget);
42 RegisterTargetMachine Y(TheMipselTarget);
43 RegisterTargetMachine A(TheMips64Target);
44 RegisterTargetMachinelTargetMachine> B(TheMips64elTarget);
41 RegisterTargetMachinebTargetMachine> X(getTheMipsTarget());
42 RegisterTargetMachine Y(getTheMipselTarget());
43 RegisterTargetMachine A(getTheMips64Target());
44 RegisterTargetMachine B(getTheMips64elTarget());
4545 }
4646
4747 static std::string computeDataLayout(const Triple &TT, StringRef CPU,
1111 #include "llvm/Support/TargetRegistry.h"
1212 using namespace llvm;
1313
14 Target llvm::TheMipsTarget, llvm::TheMipselTarget;
15 Target llvm::TheMips64Target, llvm::TheMips64elTarget;
14 Target &llvm::getTheMipsTarget() {
15 static Target TheMipsTarget;
16 return TheMipsTarget;
17 }
18 Target &llvm::getTheMipselTarget() {
19 static Target TheMipselTarget;
20 return TheMipselTarget;
21 }
22 Target &llvm::getTheMips64Target() {
23 static Target TheMips64Target;
24 return TheMips64Target;
25 }
26 Target &llvm::getTheMips64elTarget() {
27 static Target TheMips64elTarget;
28 return TheMips64elTarget;
29 }
1630
1731 extern "C" void LLVMInitializeMipsTargetInfo() {
1832 RegisterTarget
19 /*HasJIT=*/true> X(TheMipsTarget, "mips", "Mips");
33 /*HasJIT=*/true>
34 X(getTheMipsTarget(), "mips", "Mips");
2035
2136 RegisterTarget
22 /*HasJIT=*/true> Y(TheMipselTarget, "mipsel", "Mipsel");
37 /*HasJIT=*/true>
38 Y(getTheMipselTarget(), "mipsel", "Mipsel");
2339
2440 RegisterTarget
25 /*HasJIT=*/true> A(TheMips64Target, "mips64", "Mips64 [experimental]");
41 /*HasJIT=*/true>
42 A(getTheMips64Target(), "mips64", "Mips64 [experimental]");
2643
2744 RegisterTarget
28 /*HasJIT=*/true> B(TheMips64elTarget,
29 "mips64el", "Mips64el [experimental]");
45 /*HasJIT=*/true>
46 B(getTheMips64elTarget(), "mips64el", "Mips64el [experimental]");
3047 }
5959
6060 // Force static initialization.
6161 extern "C" void LLVMInitializeNVPTXTargetMC() {
62 for (Target *T : {&TheNVPTXTarget32, &TheNVPTXTarget64}) {
62 for (Target *T : {&getTheNVPTXTarget32(), &getTheNVPTXTarget64()}) {
6363 // Register the MC asm info.
6464 RegisterMCAsmInfo X(*T);
6565
1818 namespace llvm {
1919 class Target;
2020
21 extern Target TheNVPTXTarget32;
22 extern Target TheNVPTXTarget64;
21 Target &getTheNVPTXTarget32();
22 Target &getTheNVPTXTarget64();
2323
2424 } // End llvm namespace
2525
5656 BasicBlockPass *createNVPTXLowerAllocaPass();
5757 MachineFunctionPass *createNVPTXPeephole();
5858
59 extern Target TheNVPTXTarget32;
60 extern Target TheNVPTXTarget64;
59 Target &getTheNVPTXTarget32();
60 Target &getTheNVPTXTarget64();
6161
6262 namespace NVPTX {
6363 enum DrvInterface {
23792379
23802380 // Force static initialization.
23812381 extern "C" void LLVMInitializeNVPTXAsmPrinter() {
2382 RegisterAsmPrinter X(TheNVPTXTarget32);
2383 RegisterAsmPrinter Y(TheNVPTXTarget64);
2384 }
2382 RegisterAsmPrinter X(getTheNVPTXTarget32());
2383 RegisterAsmPrinter Y(getTheNVPTXTarget64());
2384 }
7575
7676 extern "C" void LLVMInitializeNVPTXTarget() {
7777 // Register the target.
78 RegisterTargetMachine X(TheNVPTXTarget32);
79 RegisterTargetMachine64> Y(TheNVPTXTarget64);
78 RegisterTargetMachine32> X(getTheNVPTXTarget32());
79 RegisterTargetMachine Y(getTheNVPTXTarget64());
8080
8181 // FIXME: This pass is really intended to be invoked during IR optimization,
8282 // but it's very NVPTX-specific.
1111 #include "llvm/Support/TargetRegistry.h"
1212 using namespace llvm;
1313
14 Target llvm::TheNVPTXTarget32;
15 Target llvm::TheNVPTXTarget64;
14 Target &llvm::getTheNVPTXTarget32() {
15 static Target TheNVPTXTarget32;
16 return TheNVPTXTarget32;
17 }
18 Target &llvm::getTheNVPTXTarget64() {
19 static Target TheNVPTXTarget64;
20 return TheNVPTXTarget64;
21 }
1622
1723 extern "C" void LLVMInitializeNVPTXTargetInfo() {
18 RegisterTarget X(TheNVPTXTarget32, "nvptx",
24 RegisterTarget X(getTheNVPTXTarget32(), "nvptx",
1925 "NVIDIA PTX 32-bit");
20 RegisterTarget Y(TheNVPTXTarget64, "nvptx64",
26 RegisterTarget Y(getTheNVPTXTarget64(), "nvptx64",
2127 "NVIDIA PTX 64-bit");
2228 }
19791979
19801980 /// Force static initialization.
19811981 extern "C" void LLVMInitializePowerPCAsmParser() {
1982 RegisterMCAsmParser A(ThePPC32Target);
1983 RegisterMCAsmParser B(ThePPC64Target);
1984 RegisterMCAsmParser C(ThePPC64LETarget);
1982 RegisterMCAsmParser A(getThePPC32Target());
1983 RegisterMCAsmParser B(getThePPC64Target());
1984 RegisterMCAsmParser C(getThePPC64LETarget());
19851985 }
19861986
19871987 #define GET_REGISTER_MATCHER
5050
5151 extern "C" void LLVMInitializePowerPCDisassembler() {
5252 // Register the disassembler for each target.
53 TargetRegistry::RegisterMCDisassembler(ThePPC32Target,
53 TargetRegistry::RegisterMCDisassembler(getThePPC32Target(),
5454 createPPCDisassembler);
55 TargetRegistry::RegisterMCDisassembler(ThePPC64Target,
55 TargetRegistry::RegisterMCDisassembler(getThePPC64Target(),
5656 createPPCDisassembler);
57 TargetRegistry::RegisterMCDisassembler(ThePPC64LETarget,
57 TargetRegistry::RegisterMCDisassembler(getThePPC64LETarget(),
5858 createPPCLEDisassembler);
5959 }
6060
227227 }
228228
229229 extern "C" void LLVMInitializePowerPCTargetMC() {
230 for (Target *T : {&ThePPC32Target, &ThePPC64Target, &ThePPC64LETarget}) {
230 for (Target *T :
231 {&getThePPC32Target(), &getThePPC64Target(), &getThePPC64LETarget()}) {
231232 // Register the MC asm info.
232233 RegisterMCAsmInfoFn C(*T, createPPCMCAsmInfo);
233234
3434 class raw_pwrite_stream;
3535 class raw_ostream;
3636
37 extern Target ThePPC32Target;
38 extern Target ThePPC64Target;
39 extern Target ThePPC64LETarget;
37 Target &getThePPC32Target();
38 Target &getThePPC64Target();
39 Target &getThePPC64LETarget();
4040
4141 MCCodeEmitter *createPPCMCCodeEmitter(const MCInstrInfo &MCII,
4242 const MCRegisterInfo &MRI,
14461446
14471447 // Force static initialization.
14481448 extern "C" void LLVMInitializePowerPCAsmPrinter() {
1449 TargetRegistry::RegisterAsmPrinter(ThePPC32Target, createPPCAsmPrinterPass);
1450 TargetRegistry::RegisterAsmPrinter(ThePPC64Target, createPPCAsmPrinterPass);
1451 TargetRegistry::RegisterAsmPrinter(ThePPC64LETarget, createPPCAsmPrinterPass);
1452 }
1449 TargetRegistry::RegisterAsmPrinter(getThePPC32Target(),
1450 createPPCAsmPrinterPass);
1451 TargetRegistry::RegisterAsmPrinter(getThePPC64Target(),
1452 createPPCAsmPrinterPass);
1453 TargetRegistry::RegisterAsmPrinter(getThePPC64LETarget(),
1454 createPPCAsmPrinterPass);
1455 }
7373
7474 extern "C" void LLVMInitializePowerPCTarget() {
7575 // Register the targets
76 RegisterTargetMachine A(ThePPC32Target);
77 RegisterTargetMachine B(ThePPC64Target);
78 RegisterTargetMachine64TargetMachine> C(ThePPC64LETarget);
76 RegisterTargetMachine32TargetMachine> A(getThePPC32Target());
77 RegisterTargetMachine B(getThePPC64Target());
78 RegisterTargetMachine C(getThePPC64LETarget());
7979
8080 PassRegistry &PR = *PassRegistry::getPassRegistry();
8181 initializePPCBoolRetToIntPass(PR);
1111 #include "llvm/Support/TargetRegistry.h"
1212 using namespace llvm;
1313
14 Target llvm::ThePPC32Target, llvm::ThePPC64Target, llvm::ThePPC64LETarget;
14 Target &llvm::getThePPC32Target() {
15 static Target ThePPC32Target;
16 return ThePPC32Target;
17 }
18 Target &llvm::getThePPC64Target() {
19 static Target ThePPC64Target;
20 return ThePPC64Target;
21 }
22 Target &llvm::getThePPC64LETarget() {
23 static Target ThePPC64LETarget;
24 return ThePPC64LETarget;
25 }
1526
1627 extern "C" void LLVMInitializePowerPCTargetInfo() {
17 RegisterTarget
18 X(ThePPC32Target, "ppc32", "PowerPC 32");
28 RegisterTarget X(getThePPC32Target(), "ppc32",
29 "PowerPC 32");
1930
20 RegisterTarget
21 Y(ThePPC64Target, "ppc64", "PowerPC 64");
31 RegisterTarget Y(getThePPC64Target(), "ppc64",
32 "PowerPC 64");
2233
23 RegisterTarget
24 Z(ThePPC64LETarget, "ppc64le", "PowerPC 64 LE");
34 RegisterTarget Z(
35 getThePPC64LETarget(), "ppc64le", "PowerPC 64 LE");
2536 }
12621262 }
12631263
12641264 extern "C" void LLVMInitializeSparcAsmParser() {
1265 RegisterMCAsmParser A(TheSparcTarget);
1266 RegisterMCAsmParser B(TheSparcV9Target);
1267 RegisterMCAsmParser C(TheSparcelTarget);
1265 RegisterMCAsmParser A(getTheSparcTarget());
1266 RegisterMCAsmParser B(getTheSparcV9Target());
1267 RegisterMCAsmParser C(getTheSparcelTarget());
12681268 }
12691269
12701270 #define GET_REGISTER_MATCHER
4343 }
4444
4545 namespace llvm {
46 extern Target TheSparcTarget, TheSparcV9Target, TheSparcelTarget;
46 Target &getTheSparcTarget();
47 Target &getTheSparcV9Target();
48 Target &getTheSparcelTarget();
4749 }
4850
4951 static MCDisassembler *createSparcDisassembler(const Target &T,
5557
5658 extern "C" void LLVMInitializeSparcDisassembler() {
5759 // Register the disassembler.
58 TargetRegistry::RegisterMCDisassembler(TheSparcTarget,
60 TargetRegistry::RegisterMCDisassembler(getTheSparcTarget(),
5961 createSparcDisassembler);
60 TargetRegistry::RegisterMCDisassembler(TheSparcV9Target,
62 TargetRegistry::RegisterMCDisassembler(getTheSparcV9Target(),
6163 createSparcDisassembler);
62 TargetRegistry::RegisterMCDisassembler(TheSparcelTarget,
64 TargetRegistry::RegisterMCDisassembler(getTheSparcelTarget(),
6365 createSparcDisassembler);
6466 }
6567
127127
128128 extern "C" void LLVMInitializeSparcTargetMC() {
129129 // Register the MC asm info.
130 RegisterMCAsmInfoFn X(TheSparcTarget, createSparcMCAsmInfo);
131 RegisterMCAsmInfoFn Y(TheSparcV9Target, createSparcV9MCAsmInfo);
132 RegisterMCAsmInfoFn Z(TheSparcelTarget, createSparcMCAsmInfo);
130 RegisterMCAsmInfoFn X(getTheSparcTarget(), createSparcMCAsmInfo);
131 RegisterMCAsmInfoFn Y(getTheSparcV9Target(), createSparcV9MCAsmInfo);
132 RegisterMCAsmInfoFn Z(getTheSparcelTarget(), createSparcMCAsmInfo);
133133
134 for (Target *T : {&TheSparcTarget, &TheSparcV9Target, &TheSparcelTarget}) {
134 for (Target *T :
135 {&getTheSparcTarget(), &getTheSparcV9Target(), &getTheSparcelTarget()}) {
135136 // Register the MC instruction info.
136137 TargetRegistry::RegisterMCInstrInfo(*T, createSparcMCInstrInfo);
137138
159160 }
160161
161162 // Register the MC codegen info.
162 TargetRegistry::registerMCAdjustCodeGenOpts(TheSparcTarget,
163 TargetRegistry::registerMCAdjustCodeGenOpts(getTheSparcTarget(),
163164 adjustCodeGenOpts);
164 TargetRegistry::registerMCAdjustCodeGenOpts(TheSparcV9Target,
165 TargetRegistry::registerMCAdjustCodeGenOpts(getTheSparcV9Target(),
165166 adjustCodeGenOptsV9);
166 TargetRegistry::registerMCAdjustCodeGenOpts(TheSparcelTarget,
167 TargetRegistry::registerMCAdjustCodeGenOpts(getTheSparcelTarget(),
167168 adjustCodeGenOpts);
168169 }
3030 class raw_pwrite_stream;
3131 class raw_ostream;
3232
33 extern Target TheSparcTarget;
34 extern Target TheSparcV9Target;
35 extern Target TheSparcelTarget;
33 Target &getTheSparcTarget();
34 Target &getTheSparcV9Target();
35 Target &getTheSparcelTarget();
3636
3737 MCCodeEmitter *createSparcMCCodeEmitter(const MCInstrInfo &MCII,
3838 const MCRegisterInfo &MRI,
442442
443443 // Force static initialization.
444444 extern "C" void LLVMInitializeSparcAsmPrinter() {
445 RegisterAsmPrinter X(TheSparcTarget);
446 RegisterAsmPrinter Y(TheSparcV9Target);
447 RegisterAsmPrinter Z(TheSparcelTarget);
448 }
445 RegisterAsmPrinter X(getTheSparcTarget());
446 RegisterAsmPrinter Y(getTheSparcV9Target());
447 RegisterAsmPrinter Z(getTheSparcelTarget());
448 }
2121
2222 extern "C" void LLVMInitializeSparcTarget() {
2323 // Register the target.
24 RegisterTargetMachine X(TheSparcTarget);
25 RegisterTargetMachine Y(TheSparcV9Target);
26 RegisterTargetMachineelTargetMachine> Z(TheSparcelTarget);
24 RegisterTargetMachineV8TargetMachine> X(getTheSparcTarget());
25 RegisterTargetMachine Y(getTheSparcV9Target());
26 RegisterTargetMachine Z(getTheSparcelTarget());
2727 }
2828
2929 static std::string computeDataLayout(const Triple &T, bool is64Bit) {
1111 #include "llvm/Support/TargetRegistry.h"
1212 using namespace llvm;
1313
14 Target llvm::TheSparcTarget;
15 Target llvm::TheSparcV9Target;
16 Target llvm::TheSparcelTarget;
14 Target &llvm::getTheSparcTarget() {
15 static Target TheSparcTarget;
16 return TheSparcTarget;
17 }
18 Target &llvm::getTheSparcV9Target() {
19 static Target TheSparcV9Target;
20 return TheSparcV9Target;
21 }
22 Target &llvm::getTheSparcelTarget() {
23 static Target TheSparcelTarget;
24 return TheSparcelTarget;
25 }
1726
1827 extern "C" void LLVMInitializeSparcTargetInfo() {
19 RegisterTarget X(TheSparcTarget, "sparc",
28 RegisterTarget X(getTheSparcTarget(), "sparc",
2029 "Sparc");
21 RegisterTarget Y(TheSparcV9Target,
30 RegisterTarget Y(getTheSparcV9Target(),
2231 "sparcv9", "Sparc V9");
23 RegisterTarget Z(TheSparcelTarget,
32 RegisterTarget Z(getTheSparcelTarget(),
2433 "sparcel", "Sparc LE");
2534 }
11701170
11711171 // Force static initialization.
11721172 extern "C" void LLVMInitializeSystemZAsmParser() {
1173 RegisterMCAsmParser X(TheSystemZTarget);
1174 }
1173 RegisterMCAsmParser X(getTheSystemZTarget());
1174 }
4141
4242 extern "C" void LLVMInitializeSystemZDisassembler() {
4343 // Register the disassembler.
44 TargetRegistry::RegisterMCDisassembler(TheSystemZTarget,
44 TargetRegistry::RegisterMCDisassembler(getTheSystemZTarget(),
4545 createSystemZDisassembler);
4646 }
4747
204204
205205 extern "C" void LLVMInitializeSystemZTargetMC() {
206206 // Register the MCAsmInfo.
207 TargetRegistry::RegisterMCAsmInfo(TheSystemZTarget,
207 TargetRegistry::RegisterMCAsmInfo(getTheSystemZTarget(),
208208 createSystemZMCAsmInfo);
209209
210210 // Register the adjustCodeGenOpts.
211 TargetRegistry::registerMCAdjustCodeGenOpts(TheSystemZTarget,
211 TargetRegistry::registerMCAdjustCodeGenOpts(getTheSystemZTarget(),
212212 adjustCodeGenOpts);
213213
214214 // Register the MCCodeEmitter.
215 TargetRegistry::RegisterMCCodeEmitter(TheSystemZTarget,
215 TargetRegistry::RegisterMCCodeEmitter(getTheSystemZTarget(),
216216 createSystemZMCCodeEmitter);
217217
218218 // Register the MCInstrInfo.
219 TargetRegistry::RegisterMCInstrInfo(TheSystemZTarget,
219 TargetRegistry::RegisterMCInstrInfo(getTheSystemZTarget(),
220220 createSystemZMCInstrInfo);
221221
222222 // Register the MCRegisterInfo.
223 TargetRegistry::RegisterMCRegInfo(TheSystemZTarget,
223 TargetRegistry::RegisterMCRegInfo(getTheSystemZTarget(),
224224 createSystemZMCRegisterInfo);
225225
226226 // Register the MCSubtargetInfo.
227 TargetRegistry::RegisterMCSubtargetInfo(TheSystemZTarget,
227 TargetRegistry::RegisterMCSubtargetInfo(getTheSystemZTarget(),
228228 createSystemZMCSubtargetInfo);
229229
230230 // Register the MCAsmBackend.
231 TargetRegistry::RegisterMCAsmBackend(TheSystemZTarget,
231 TargetRegistry::RegisterMCAsmBackend(getTheSystemZTarget(),
232232 createSystemZMCAsmBackend);
233233
234234 // Register the MCInstPrinter.
235 TargetRegistry::RegisterMCInstPrinter(TheSystemZTarget,
235 TargetRegistry::RegisterMCInstPrinter(getTheSystemZTarget(),
236236 createSystemZMCInstPrinter);
237237 }
2727 class raw_pwrite_stream;
2828 class raw_ostream;
2929
30 extern Target TheSystemZTarget;
30 Target &getTheSystemZTarget();
3131
3232 namespace SystemZMC {
3333 // How many bytes are in the ABI-defined, caller-allocated part of
522522
523523 // Force static initialization.
524524 extern "C" void LLVMInitializeSystemZAsmPrinter() {
525 RegisterAsmPrinter X(TheSystemZTarget);
526 }
525 RegisterAsmPrinter X(getTheSystemZTarget());
526 }
1919 extern cl::opt MISchedPostRA;
2020 extern "C" void LLVMInitializeSystemZTarget() {
2121 // Register the target.
22 RegisterTargetMachine X(TheSystemZTarget);
22 RegisterTargetMachine X(getTheSystemZTarget());
2323 }
2424
2525 // Determine whether we use the vector ABI.
1111
1212 using namespace llvm;
1313
14 Target llvm::TheSystemZTarget;
14 Target &llvm::getTheSystemZTarget() {
15 static Target TheSystemZTarget;
16 return TheSystemZTarget;
17 }
1518
1619 extern "C" void LLVMInitializeSystemZTargetInfo() {
17 RegisterTarget
18 X(TheSystemZTarget, "systemz", "SystemZ");
20 RegisterTarget X(getTheSystemZTarget(),
21 "systemz", "SystemZ");
1922 }
5353
5454 extern "C" void LLVMInitializeWebAssemblyDisassembler() {
5555 // Register the disassembler for each target.
56 TargetRegistry::RegisterMCDisassembler(TheWebAssemblyTarget32,
56 TargetRegistry::RegisterMCDisassembler(getTheWebAssemblyTarget32(),
5757 createWebAssemblyDisassembler);
58 TargetRegistry::RegisterMCDisassembler(TheWebAssemblyTarget64,
58 TargetRegistry::RegisterMCDisassembler(getTheWebAssemblyTarget64(),
5959 createWebAssemblyDisassembler);
6060 }
6161
100100
101101 // Force static initialization.
102102 extern "C" void LLVMInitializeWebAssemblyTargetMC() {
103 for (Target *T : {&TheWebAssemblyTarget32, &TheWebAssemblyTarget64}) {
103 for (Target *T :
104 {&getTheWebAssemblyTarget32(), &getTheWebAssemblyTarget64()}) {
104105 // Register the MC asm info.
105106 RegisterMCAsmInfoFn X(*T, createMCAsmInfo);
106107
2929 class Triple;
3030 class raw_pwrite_stream;
3131
32 extern Target TheWebAssemblyTarget32;
33 extern Target TheWebAssemblyTarget64;
32 Target &getTheWebAssemblyTarget32();
33 Target &getTheWebAssemblyTarget64();
3434
3535 MCCodeEmitter *createWebAssemblyMCCodeEmitter(const MCInstrInfo &MCII);
3636
1818
1919 #define DEBUG_TYPE "wasm-target-info"
2020
21 Target llvm::TheWebAssemblyTarget32;
22 Target llvm::TheWebAssemblyTarget64;
21 Target llvm::getTheWebAssemblyTarget32();
22 Target llvm::getTheWebAssemblyTarget64();
2323
2424 extern "C" void LLVMInitializeWebAssemblyTargetInfo() {
25 RegisterTarget X(TheWebAssemblyTarget32, "wasm32",
25 RegisterTarget X(getTheWebAssemblyTarget32(), "wasm32",
2626 "WebAssembly 32-bit");
27 RegisterTarget Y(TheWebAssemblyTarget64, "wasm64",
27 RegisterTarget Y(getTheWebAssemblyTarget64(), "wasm64",
2828 "WebAssembly 64-bit");
2929 }
312312
313313 // Force static initialization.
314314 extern "C" void LLVMInitializeWebAssemblyAsmPrinter() {
315 RegisterAsmPrinter X(TheWebAssemblyTarget32);
316 RegisterAsmPrinter Y(TheWebAssemblyTarget64);
317 }
315 RegisterAsmPrinter X(getTheWebAssemblyTarget32());
316 RegisterAsmPrinter Y(getTheWebAssemblyTarget64());
317 }
4242
4343 extern "C" void LLVMInitializeWebAssemblyTarget() {
4444 // Register the target.
45 RegisterTargetMachine X(TheWebAssemblyTarget32);
46 RegisterTargetMachine Y(TheWebAssemblyTarget64);
45 RegisterTargetMachine X(
46 getTheWebAssemblyTarget32());
47 RegisterTargetMachine Y(
48 getTheWebAssemblyTarget64());
4749
4850 // Register exception handling pass to opt
4951 initializeWebAssemblyLowerEmscriptenEHSjLjPass(
30643064
30653065 // Force static initialization.
30663066 extern "C" void LLVMInitializeX86AsmParser() {
3067 RegisterMCAsmParser X(TheX86_32Target);
3068 RegisterMCAsmParser Y(TheX86_64Target);
3067 RegisterMCAsmParser X(getTheX86_32Target());
3068 RegisterMCAsmParser Y(getTheX86_64Target());
30693069 }
30703070
30713071 #define GET_REGISTER_MATCHER
10651065
10661066 extern "C" void LLVMInitializeX86Disassembler() {
10671067 // Register the disassembler.
1068 TargetRegistry::RegisterMCDisassembler(TheX86_32Target,
1068 TargetRegistry::RegisterMCDisassembler(getTheX86_32Target(),
10691069 createX86Disassembler);
1070 TargetRegistry::RegisterMCDisassembler(TheX86_64Target,
1070 TargetRegistry::RegisterMCDisassembler(getTheX86_64Target(),
10711071 createX86Disassembler);
10721072 }
233233
234234 // Force static initialization.
235235 extern "C" void LLVMInitializeX86TargetMC() {
236 for (Target *T : {&TheX86_32Target, &TheX86_64Target}) {
236 for (Target *T : {&getTheX86_32Target(), &getTheX86_64Target()}) {
237237 // Register the MC asm info.
238238 RegisterMCAsmInfoFn X(*T, createX86MCAsmInfo);
239239
267267 }
268268
269269 // Register the asm backend.
270 TargetRegistry::RegisterMCAsmBackend(TheX86_32Target,
270 TargetRegistry::RegisterMCAsmBackend(getTheX86_32Target(),
271271 createX86_32AsmBackend);
272 TargetRegistry::RegisterMCAsmBackend(TheX86_64Target,
272 TargetRegistry::RegisterMCAsmBackend(getTheX86_64Target(),
273273 createX86_64AsmBackend);
274274 }
275275
3333 class raw_ostream;
3434 class raw_pwrite_stream;
3535
36 extern Target TheX86_32Target, TheX86_64Target;
36 Target &getTheX86_32Target();
37 Target &getTheX86_64Target();
3738
3839 /// Flavour of dwarf regnumbers
3940 ///
1010 #include "llvm/Support/TargetRegistry.h"
1111 using namespace llvm;
1212
13 Target llvm::TheX86_32Target, llvm::TheX86_64Target;
13 Target &llvm::getTheX86_32Target() {
14 static Target TheX86_32Target;
15 return TheX86_32Target;
16 }
17 Target &llvm::getTheX86_64Target() {
18 static Target TheX86_64Target;
19 return TheX86_64Target;
20 }
1421
1522 extern "C" void LLVMInitializeX86TargetInfo() {
16 RegisterTarget
17 X(TheX86_32Target, "x86", "32-bit X86: Pentium-Pro and above");
23 RegisterTarget X(
24 getTheX86_32Target(), "x86", "32-bit X86: Pentium-Pro and above");
1825
19 RegisterTarget
20 Y(TheX86_64Target, "x86-64", "64-bit X86: EM64T and AMD64");
26 RegisterTarget Y(
27 getTheX86_64Target(), "x86-64", "64-bit X86: EM64T and AMD64");
2128 }
655655
656656 // Force static initialization.
657657 extern "C" void LLVMInitializeX86AsmPrinter() {
658 RegisterAsmPrinter X(TheX86_32Target);
659 RegisterAsmPrinter Y(TheX86_64Target);
660 }
658 RegisterAsmPrinter X(getTheX86_32Target());
659 RegisterAsmPrinter Y(getTheX86_64Target());
660 }
3434
3535 extern "C" void LLVMInitializeX86Target() {
3636 // Register the target.
37 RegisterTargetMachine X(TheX86_32Target);
38 RegisterTargetMachine Y(TheX86_64Target);
37 RegisterTargetMachine X(getTheX86_32Target());
38 RegisterTargetMachine Y(getTheX86_64Target());
3939
4040 PassRegistry &PR = *PassRegistry::getPassRegistry();
4141 initializeWinEHStatePassPass(PR);