llvm.org GIT mirror llvm / 9f6eb4e
Revert CMake: Make most target symbols hidden by default This reverts r362990 (git commit 374571301dc8e9bc9fdd1d70f86015de198673bd) This was causing linker warnings on Darwin: ld: warning: direct access in function 'llvm::initializeEvexToVexInstPassPass(llvm::PassRegistry&)' from file '../../lib/libLLVMX86CodeGen.a(X86EvexToVex.cpp.o)' to global weak symbol 'void std::__1::__call_once_proxy<std::__1::tuple<void* (&)(llvm::PassRegistry&), std::__1::reference_wrapper<llvm::PassRegistry>&&> >(void*)' from file '../../lib/libLLVMCore.a(Verifier.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363028 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard a month ago
114 changed file(s) with 111 addition(s) and 151 deletion(s). Raw diff Collapse all Expand all
9999 /// not accessible from outside it. Can also be used to mark variables and
100100 /// functions, making them private to any shared library they are linked into.
101101 /// On PE/COFF targets, library visibility is the default, so this isn't needed.
102 ///
103 /// LLVM_EXTERNAL_VISIBILITY - classes, functions, and variables marked with this
104 /// attribute will be made public and visible outside of any shared library they
105 /// are linked in to.
106102 #if (__has_attribute(visibility) || LLVM_GNUC_PREREQ(4, 0, 0)) && \
107103 !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32)
108104 #define LLVM_LIBRARY_VISIBILITY __attribute__ ((visibility("hidden")))
109 #define LLVM_EXTERNAL_VISIBILITY __attribute__ ((visibility("default")))
110105 #else
111106 #define LLVM_LIBRARY_VISIBILITY
112 #define LLVM_EXTERNAL_VISIBILITY
113107 #endif
114108
115109 #if defined(__GNUC__)
11281128 }
11291129
11301130 // Force static initialization.
1131 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAArch64AsmPrinter() {
1131 extern "C" void LLVMInitializeAArch64AsmPrinter() {
11321132 RegisterAsmPrinter X(getTheAArch64leTarget());
11331133 RegisterAsmPrinter Y(getTheAArch64beTarget());
11341134 RegisterAsmPrinter Z(getTheARM64Target());
151151 cl::desc("Enable the AAcrh64 branch target pass"),
152152 cl::init(true));
153153
154 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAArch64Target() {
154 extern "C" void LLVMInitializeAArch64Target() {
155155 // Register the target.
156156 RegisterTargetMachine X(getTheAArch64leTarget());
157157 RegisterTargetMachine Y(getTheAArch64beTarget());
55135513 }
55145514
55155515 /// Force static initialization.
5516 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAArch64AsmParser() {
5516 extern "C" void LLVMInitializeAArch64AsmParser() {
55175517 RegisterMCAsmParser X(getTheAArch64leTarget());
55185518 RegisterMCAsmParser Y(getTheAArch64beTarget());
55195519 RegisterMCAsmParser Z(getTheARM64Target());
277277 SymbolLookUp, DisInfo);
278278 }
279279
280 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAArch64Disassembler() {
280 extern "C" void LLVMInitializeAArch64Disassembler() {
281281 TargetRegistry::RegisterMCDisassembler(getTheAArch64leTarget(),
282282 createAArch64Disassembler);
283283 TargetRegistry::RegisterMCDisassembler(getTheAArch64beTarget(),
364364 }
365365
366366 // Force static initialization.
367 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAArch64TargetMC() {
367 extern "C" void LLVMInitializeAArch64TargetMC() {
368368 for (Target *T : {&getTheAArch64leTarget(), &getTheAArch64beTarget(),
369369 &getTheAArch64_32Target(), &getTheARM64Target(),
370370 &getTheARM64_32Target()}) {
3030 return TheARM64_32Target;
3131 }
3232
33 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAArch64TargetInfo() {
33 extern "C" void LLVMInitializeAArch64TargetInfo() {
3434 // Now register the "arm64" name for use with "-march". We don't want it to
3535 // take possession of the Triple::aarch64 tags though.
3636 TargetRegistry::RegisterTarget(getTheARM64Target(), "arm64",
9090 return new AMDGPUAsmPrinter(tm, std::move(Streamer));
9191 }
9292
93 extern "C" void LLVM_EXTERNAL_VISIBILITY LLVMInitializeAMDGPUAsmPrinter() {
93 extern "C" void LLVMInitializeAMDGPUAsmPrinter() {
9494 TargetRegistry::RegisterAsmPrinter(getTheAMDGPUTarget(),
9595 llvm::createR600AsmPrinterPass);
9696 TargetRegistry::RegisterAsmPrinter(getTheGCNTarget(),
181181 cl::init(true),
182182 cl::Hidden);
183183
184 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() {
184 extern "C" void LLVMInitializeAMDGPUTarget() {
185185 // Register the target
186186 RegisterTargetMachine X(getTheAMDGPUTarget());
187187 RegisterTargetMachine Y(getTheGCNTarget());
64036403 }
64046404
64056405 /// Force static initialization.
6406 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUAsmParser() {
6406 extern "C" void LLVMInitializeAMDGPUAsmParser() {
64076407 RegisterMCAsmParser A(getTheAMDGPUTarget());
64086408 RegisterMCAsmParser B(getTheGCNTarget());
64096409 }
10901090 return new AMDGPUDisassembler(STI, Ctx, T.createMCInstrInfo());
10911091 }
10921092
1093 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUDisassembler() {
1093 extern "C" void LLVMInitializeAMDGPUDisassembler() {
10941094 TargetRegistry::RegisterMCDisassembler(getTheGCNTarget(),
10951095 createAMDGPUDisassembler);
10961096 TargetRegistry::RegisterMCSymbolizer(getTheGCNTarget(),
133133 return new AMDGPUMCInstrAnalysis(Info);
134134 }
135135
136 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTargetMC() {
136 extern "C" void LLVMInitializeAMDGPUTargetMC() {
137137
138138 TargetRegistry::RegisterMCInstrInfo(getTheGCNTarget(), createAMDGPUMCInstrInfo);
139139 TargetRegistry::RegisterMCInstrInfo(getTheAMDGPUTarget(), createR600MCInstrInfo);
2727 }
2828
2929 /// Extern function to initialize the targets for the AMDGPU backend
30 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTargetInfo() {
30 extern "C" void LLVMInitializeAMDGPUTargetInfo() {
3131 RegisterTarget R600(getTheAMDGPUTarget(), "r600",
3232 "AMD GPUs HD2XXX-HD6XXX", "AMDGPU");
3333 RegisterTarget GCN(getTheGCNTarget(), "amdgcn",
6161 }
6262
6363 // Force static initialization.
64 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARCAsmPrinter() {
64 extern "C" void LLVMInitializeARCAsmPrinter() {
6565 RegisterAsmPrinter X(getTheARCTarget());
6666 }
8080 }
8181
8282 // Force static initialization.
83 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARCTarget() {
83 extern "C" void LLVMInitializeARCTarget() {
8484 RegisterTargetMachine X(getTheARCTarget());
8585 }
8686
364364 return new ARCDisassembler(STI, Ctx, T.createMCInstrInfo());
365365 }
366366
367 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARCDisassembler() {
367 extern "C" void LLVMInitializeARCDisassembler() {
368368 // Register the disassembler.
369369 TargetRegistry::RegisterMCDisassembler(getTheARCTarget(),
370370 createARCDisassembler);
8080 }
8181
8282 // Force static initialization.
83 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARCTargetMC() {
83 extern "C" void LLVMInitializeARCTargetMC() {
8484 // Register the MC asm info.
8585 Target &TheARCTarget = getTheARCTarget();
8686 RegisterMCAsmInfoFn X(TheARCTarget, createARCMCAsmInfo);
1515 return TheARCTarget;
1616 }
1717
18 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARCTargetInfo() {
18 extern "C" void LLVMInitializeARCTargetInfo() {
1919 RegisterTarget X(getTheARCTarget(), "arc", "ARC", "ARC");
2020 }
20652065 //===----------------------------------------------------------------------===//
20662066
20672067 // Force static initialization.
2068 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARMAsmPrinter() {
2068 extern "C" void LLVMInitializeARMAsmPrinter() {
20692069 RegisterAsmPrinter X(getTheARMLETarget());
20702070 RegisterAsmPrinter Y(getTheARMBETarget());
20712071 RegisterAsmPrinter A(getTheThumbLETarget());
7777 void initializeARMExecutionDomainFixPass(PassRegistry&);
7878 }
7979
80 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARMTarget() {
80 extern "C" void LLVMInitializeARMTarget() {
8181 // Register the target.
8282 RegisterTargetMachine X(getTheARMLETarget());
8383 RegisterTargetMachine A(getTheThumbLETarget());
1038910389 }
1039010390
1039110391 /// Force static initialization.
10392 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARMAsmParser() {
10392 extern "C" void LLVMInitializeARMAsmParser() {
1039310393 RegisterMCAsmParser X(getTheARMLETarget());
1039410394 RegisterMCAsmParser Y(getTheARMBETarget());
1039510395 RegisterMCAsmParser A(getTheThumbLETarget());
873873 return MCDisassembler::Fail;
874874 }
875875
876 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARMDisassembler() {
876 extern "C" void LLVMInitializeARMDisassembler() {
877877 TargetRegistry::RegisterMCDisassembler(getTheARMLETarget(),
878878 createARMDisassembler);
879879 TargetRegistry::RegisterMCDisassembler(getTheARMBETarget(),
299299 }
300300
301301 // Force static initialization.
302 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARMTargetMC() {
302 extern "C" void LLVMInitializeARMTargetMC() {
303303 for (Target *T : {&getTheARMLETarget(), &getTheARMBETarget(),
304304 &getTheThumbLETarget(), &getTheThumbBETarget()}) {
305305 // Register the MC asm info.
2626 return TheThumbBETarget;
2727 }
2828
29 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARMTargetInfo() {
29 extern "C" void LLVMInitializeARMTargetInfo() {
3030 RegisterTarget X(getTheARMLETarget(), "arm",
3131 "ARM", "ARM");
3232 RegisterTarget Y(getTheARMBETarget(), "armeb",
177177
178178 } // end of namespace llvm
179179
180 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRAsmPrinter() {
180 extern "C" void LLVMInitializeAVRAsmPrinter() {
181181 llvm::RegisterAsmPrinter X(llvm::getTheAVRTarget());
182182 }
183183
7575 return new AVRPassConfig(*this, PM);
7676 }
7777
78 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRTarget() {
78 extern "C" void LLVMInitializeAVRTarget() {
7979 // Register the target.
8080 RegisterTargetMachine X(getTheAVRTarget());
8181
681681 return (parseMany(parseOne));
682682 }
683683
684 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRAsmParser() {
684 extern "C" void LLVMInitializeAVRAsmParser() {
685685 RegisterMCAsmParser X(getTheAVRTarget());
686686 }
687687
5151 }
5252
5353
54 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRDisassembler() {
54 extern "C" void LLVMInitializeAVRDisassembler() {
5555 // Register the disassembler.
5656 TargetRegistry::RegisterMCDisassembler(getTheAVRTarget(),
5757 createAVRDisassembler);
8888 return new AVRTargetAsmStreamer(S);
8989 }
9090
91 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRTargetMC() {
91 extern "C" void LLVMInitializeAVRTargetMC() {
9292 // Register the MC asm info.
9393 RegisterMCAsmInfo X(getTheAVRTarget());
9494
1414 }
1515 }
1616
17 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRTargetInfo() {
17 extern "C" void LLVMInitializeAVRTargetInfo() {
1818 llvm::RegisterTarget X(llvm::getTheAVRTarget(), "avr",
1919 "Atmel AVR Microcontroller", "AVR");
2020 }
492492
493493 bool BPFAsmParser::ParseDirective(AsmToken DirectiveID) { return true; }
494494
495 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFAsmParser() {
495 extern "C" void LLVMInitializeBPFAsmParser() {
496496 RegisterMCAsmParser X(getTheBPFTarget());
497497 RegisterMCAsmParser Y(getTheBPFleTarget());
498498 RegisterMCAsmParser Z(getTheBPFbeTarget());
141141 }
142142
143143 // Force static initialization.
144 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFAsmPrinter() {
144 extern "C" void LLVMInitializeBPFAsmPrinter() {
145145 RegisterAsmPrinter X(getTheBPFleTarget());
146146 RegisterAsmPrinter Y(getTheBPFbeTarget());
147147 RegisterAsmPrinter Z(getTheBPFTarget());
2626 opt DisableMIPeephole("disable-bpf-peephole", cl::Hidden,
2727 cl::desc("Disable machine peepholes for BPF"));
2828
29 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFTarget() {
29 extern "C" void LLVMInitializeBPFTarget() {
3030 // Register the target.
3131 RegisterTargetMachine X(getTheBPFleTarget());
3232 RegisterTargetMachine Y(getTheBPFbeTarget());
8383 }
8484
8585
86 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFDisassembler() {
86 extern "C" void LLVMInitializeBPFDisassembler() {
8787 // Register the disassembler.
8888 TargetRegistry::RegisterMCDisassembler(getTheBPFTarget(),
8989 createBPFDisassembler);
9696 return new BPFMCInstrAnalysis(Info);
9797 }
9898
99 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFTargetMC() {
99 extern "C" void LLVMInitializeBPFTargetMC() {
100100 for (Target *T :
101101 {&getTheBPFleTarget(), &getTheBPFbeTarget(), &getTheBPFTarget()}) {
102102 // Register the MC asm info.
2323 return TheBPFTarget;
2424 }
2525
26 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFTargetInfo() {
26 extern "C" void LLVMInitializeBPFTargetInfo() {
2727 TargetRegistry::RegisterTarget(getTheBPFTarget(), "bpf", "BPF (host endian)",
2828 "BPF", [](Triple::ArchType) { return false; },
2929 true);
1212 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Target
1313 )
1414
15 # When building shared objects for each target there are some internal APIs
16 # that are used across shared objects which we can't hide.
17 if (NOT BUILD_SHARED_LIBS)
18 # Set default visibility to hidden, so we don't export all the Target classes
19 # in libLLVM.so.
20 set(CMAKE_CXX_VISIBILITY_PRESET hidden)
21 endif()
22
2315 foreach(t ${LLVM_TARGETS_TO_BUILD})
2416 message(STATUS "Targeting ${t}")
2517 add_subdirectory(${t})
812812 return true;
813813 }
814814
815 // extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonAsmLexer();
815 // extern "C" void LLVMInitializeHexagonAsmLexer();
816816
817817 /// Force static initialization.
818 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonAsmParser() {
818 extern "C" void LLVMInitializeHexagonAsmParser() {
819819 RegisterMCAsmParser X(getTheHexagonTarget());
820820 }
821821
157157 return new HexagonDisassembler(STI, Ctx, T.createMCInstrInfo());
158158 }
159159
160 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonDisassembler() {
160 extern "C" void LLVMInitializeHexagonDisassembler() {
161161 TargetRegistry::RegisterMCDisassembler(getTheHexagonTarget(),
162162 createHexagonDisassembler);
163163 }
770770 OutStreamer->EmitInstruction(MCB, getSubtargetInfo());
771771 }
772772
773 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonAsmPrinter() {
773 extern "C" void LLVMInitializeHexagonAsmPrinter() {
774774 RegisterAsmPrinter X(getTheHexagonTarget());
775775 }
179179 return *RM;
180180 }
181181
182 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonTarget() {
182 extern "C" void LLVMInitializeHexagonTarget() {
183183 // Register the target.
184184 RegisterTargetMachine X(getTheHexagonTarget());
185185
455455 }
456456
457457 // Force static initialization.
458 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonTargetMC() {
458 extern "C" void LLVMInitializeHexagonTargetMC() {
459459 // Register the MC asm info.
460460 RegisterMCAsmInfoFn X(getTheHexagonTarget(), createHexagonMCAsmInfo);
461461
1414 return TheHexagonTarget;
1515 }
1616
17 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonTargetInfo() {
17 extern "C" void LLVMInitializeHexagonTargetInfo() {
1818 RegisterTarget X(
1919 getTheHexagonTarget(), "hexagon", "Hexagon", "Hexagon");
2020 }
12221222 #define GET_MATCHER_IMPLEMENTATION
12231223 #include "LanaiGenAsmMatcher.inc"
12241224
1225 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeLanaiAsmParser() {
1225 extern "C" void LLVMInitializeLanaiAsmParser() {
12261226 RegisterMCAsmParser x(getTheLanaiTarget());
12271227 }
3535 return new LanaiDisassembler(STI, Ctx);
3636 }
3737
38 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeLanaiDisassembler() {
38 extern "C" void LLVMInitializeLanaiDisassembler() {
3939 // Register the disassembler
4040 TargetRegistry::RegisterMCDisassembler(getTheLanaiTarget(),
4141 createLanaiDisassembler);
236236 }
237237
238238 // Force static initialization.
239 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeLanaiAsmPrinter() {
239 extern "C" void LLVMInitializeLanaiAsmPrinter() {
240240 RegisterAsmPrinter X(getTheLanaiTarget());
241241 }
2929 void initializeLanaiMemAluCombinerPass(PassRegistry &);
3030 } // namespace llvm
3131
32 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeLanaiTarget() {
32 extern "C" void LLVMInitializeLanaiTarget() {
3333 // Register the target.
3434 RegisterTargetMachine registered_target(
3535 getTheLanaiTarget());
122122 return new LanaiMCInstrAnalysis(Info);
123123 }
124124
125 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeLanaiTargetMC() {
125 extern "C" void LLVMInitializeLanaiTargetMC() {
126126 // Register the MC asm info.
127127 RegisterMCAsmInfo X(getTheLanaiTarget());
128128
1515 return TheLanaiTarget;
1616 }
1717
18 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeLanaiTargetInfo() {
18 extern "C" void LLVMInitializeLanaiTargetInfo() {
1919 RegisterTarget X(getTheLanaiTarget(), "lanai", "Lanai",
2020 "Lanai");
2121 }
528528 return (parseMany(parseOne));
529529 }
530530
531 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430AsmParser() {
531 extern "C" void LLVMInitializeMSP430AsmParser() {
532532 RegisterMCAsmParser X(getTheMSP430Target());
533533 }
534534
6161 return new MSP430Disassembler(STI, Ctx);
6262 }
6363
64 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430Disassembler() {
64 extern "C" void LLVMInitializeMSP430Disassembler() {
6565 TargetRegistry::RegisterMCDisassembler(getTheMSP430Target(),
6666 createMSP430Disassembler);
6767 }
5656 return nullptr;
5757 }
5858
59 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430TargetMC() {
59 extern "C" void LLVMInitializeMSP430TargetMC() {
6060 Target &T = getTheMSP430Target();
6161
6262 RegisterMCAsmInfo X(T);
182182 }
183183
184184 // Force static initialization.
185 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430AsmPrinter() {
185 extern "C" void LLVMInitializeMSP430AsmPrinter() {
186186 RegisterAsmPrinter X(getTheMSP430Target());
187187 }
2020 #include "llvm/Support/TargetRegistry.h"
2121 using namespace llvm;
2222
23 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430Target() {
23 extern "C" void LLVMInitializeMSP430Target() {
2424 // Register the target.
2525 RegisterTargetMachine X(getTheMSP430Target());
2626 }
1414 return TheMSP430Target;
1515 }
1616
17 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430TargetInfo() {
17 extern "C" void LLVMInitializeMSP430TargetInfo() {
1818 RegisterTarget X(getTheMSP430Target(), "msp430",
1919 "MSP430 [experimental]", "MSP430");
2020 }
81898189 return false;
81908190 }
81918191
8192 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsAsmParser() {
8192 extern "C" void LLVMInitializeMipsAsmParser() {
81938193 RegisterMCAsmParser X(getTheMipsTarget());
81948194 RegisterMCAsmParser Y(getTheMipselTarget());
81958195 RegisterMCAsmParser A(getTheMips64Target());
554554 return new MipsDisassembler(STI, Ctx, false);
555555 }
556556
557 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsDisassembler() {
557 extern "C" void LLVMInitializeMipsDisassembler() {
558558 // Register the disassembler.
559559 TargetRegistry::RegisterMCDisassembler(getTheMipsTarget(),
560560 createMipsDisassembler);
161161 return new MipsMCInstrAnalysis(Info);
162162 }
163163
164 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsTargetMC() {
164 extern "C" void LLVMInitializeMipsTargetMC() {
165165 for (Target *T : {&getTheMipsTarget(), &getTheMipselTarget(),
166166 &getTheMips64Target(), &getTheMips64elTarget()}) {
167167 // Register the MC asm info.
12951295 }
12961296
12971297 // Force static initialization.
1298 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsAsmPrinter() {
1298 extern "C" void LLVMInitializeMipsAsmPrinter() {
12991299 RegisterAsmPrinter X(getTheMipsTarget());
13001300 RegisterAsmPrinter Y(getTheMipselTarget());
13011301 RegisterAsmPrinter A(getTheMips64Target());
4343
4444 #define DEBUG_TYPE "mips"
4545
46 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsTarget() {
46 extern "C" void LLVMInitializeMipsTarget() {
4747 // Register the target.
4848 RegisterTargetMachine X(getTheMipsTarget());
4949 RegisterTargetMachine Y(getTheMipselTarget());
2626 return TheMips64elTarget;
2727 }
2828
29 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsTargetInfo() {
29 extern "C" void LLVMInitializeMipsTargetInfo() {
3030 RegisterTarget
3131 /*HasJIT=*/true>
3232 X(getTheMipsTarget(), "mips", "MIPS (32-bit big endian)", "Mips");
6565 }
6666
6767 // Force static initialization.
68 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeNVPTXTargetMC() {
68 extern "C" void LLVMInitializeNVPTXTargetMC() {
6969 for (Target *T : {&getTheNVPTXTarget32(), &getTheNVPTXTarget64()}) {
7070 // Register the MC asm info.
7171 RegisterMCAsmInfo X(*T);
22592259 }
22602260
22612261 // Force static initialization.
2262 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeNVPTXAsmPrinter() {
2262 extern "C" void LLVMInitializeNVPTXAsmPrinter() {
22632263 RegisterAsmPrinter X(getTheNVPTXTarget32());
22642264 RegisterAsmPrinter Y(getTheNVPTXTarget64());
22652265 }
7171
7272 } // end namespace llvm
7373
74 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeNVPTXTarget() {
74 extern "C" void LLVMInitializeNVPTXTarget() {
7575 // Register the target.
7676 RegisterTargetMachine X(getTheNVPTXTarget32());
7777 RegisterTargetMachine Y(getTheNVPTXTarget64());
1818 return TheNVPTXTarget64;
1919 }
2020
21 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeNVPTXTargetInfo() {
21 extern "C" void LLVMInitializeNVPTXTargetInfo() {
2222 RegisterTarget X(getTheNVPTXTarget32(), "nvptx",
2323 "NVIDIA PTX 32-bit", "NVPTX");
2424 RegisterTarget Y(getTheNVPTXTarget64(), "nvptx64",
17851785
17861786
17871787 /// Force static initialization.
1788 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCAsmParser() {
1788 extern "C" void LLVMInitializePowerPCAsmParser() {
17891789 RegisterMCAsmParser A(getThePPC32Target());
17901790 RegisterMCAsmParser B(getThePPC64Target());
17911791 RegisterMCAsmParser C(getThePPC64LETarget());
5050 return new PPCDisassembler(STI, Ctx, /*IsLittleEndian=*/true);
5151 }
5252
53 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCDisassembler() {
53 extern "C" void LLVMInitializePowerPCDisassembler() {
5454 // Register the disassembler for each target.
5555 TargetRegistry::RegisterMCDisassembler(getThePPC32Target(),
5656 createPPCDisassembler);
259259 return new PPCInstPrinter(MAI, MII, MRI, T);
260260 }
261261
262 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCTargetMC() {
262 extern "C" void LLVMInitializePowerPCTargetMC() {
263263 for (Target *T :
264264 {&getThePPC32Target(), &getThePPC64Target(), &getThePPC64LETarget()}) {
265265 // Register the MC asm info.
16501650 }
16511651
16521652 // Force static initialization.
1653 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCAsmPrinter() {
1653 extern "C" void LLVMInitializePowerPCAsmPrinter() {
16541654 TargetRegistry::RegisterAsmPrinter(getThePPC32Target(),
16551655 createPPCAsmPrinterPass);
16561656 TargetRegistry::RegisterAsmPrinter(getThePPC64Target(),
9393 ReduceCRLogical("ppc-reduce-cr-logicals",
9494 cl::desc("Expand eligible cr-logical binary ops to branches"),
9595 cl::init(false), cl::Hidden);
96 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCTarget() {
96 extern "C" void LLVMInitializePowerPCTarget() {
9797 // Register the targets
9898 RegisterTargetMachine A(getThePPC32Target());
9999 RegisterTargetMachine B(getThePPC64Target());
2222 return ThePPC64LETarget;
2323 }
2424
25 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCTargetInfo() {
25 extern "C" void LLVMInitializePowerPCTargetInfo() {
2626 RegisterTarget X(getThePPC32Target(), "ppc32",
2727 "PowerPC 32", "PPC");
2828
17531753 return false;
17541754 }
17551755
1756 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVAsmParser() {
1756 extern "C" void LLVMInitializeRISCVAsmParser() {
17571757 RegisterMCAsmParser X(getTheRISCV32Target());
17581758 RegisterMCAsmParser Y(getTheRISCV64Target());
17591759 }
4747 return new RISCVDisassembler(STI, Ctx);
4848 }
4949
50 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVDisassembler() {
50 extern "C" void LLVMInitializeRISCVDisassembler() {
5151 // Register the disassembler for each target.
5252 TargetRegistry::RegisterMCDisassembler(getTheRISCV32Target(),
5353 createRISCVDisassembler);
8383 return new RISCVTargetAsmStreamer(S, OS);
8484 }
8585
86 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTargetMC() {
86 extern "C" void LLVMInitializeRISCVTargetMC() {
8787 for (Target *T : {&getTheRISCV32Target(), &getTheRISCV64Target()}) {
8888 TargetRegistry::RegisterMCAsmInfo(*T, createRISCVMCAsmInfo);
8989 TargetRegistry::RegisterMCInstrInfo(*T, createRISCVMCInstrInfo);
122122 }
123123
124124 // Force static initialization.
125 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVAsmPrinter() {
125 extern "C" void LLVMInitializeRISCVAsmPrinter() {
126126 RegisterAsmPrinter X(getTheRISCV32Target());
127127 RegisterAsmPrinter Y(getTheRISCV64Target());
128128 }
2323 #include "llvm/Target/TargetOptions.h"
2424 using namespace llvm;
2525
26 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTarget() {
26 extern "C" void LLVMInitializeRISCVTarget() {
2727 RegisterTargetMachine X(getTheRISCV32Target());
2828 RegisterTargetMachine Y(getTheRISCV64Target());
2929 auto PR = PassRegistry::getPassRegistry();
1919 return TheRISCV64Target;
2020 }
2121
22 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTargetInfo() {
22 extern "C" void LLVMInitializeRISCVTargetInfo() {
2323 RegisterTarget X(getTheRISCV32Target(), "riscv32",
2424 "32-bit RISC-V", "RISCV");
2525 RegisterTarget Y(getTheRISCV64Target(), "riscv64",
13071307 return true;
13081308 }
13091309
1310 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSparcAsmParser() {
1310 extern "C" void LLVMInitializeSparcAsmParser() {
13111311 RegisterMCAsmParser A(getTheSparcTarget());
13121312 RegisterMCAsmParser B(getTheSparcV9Target());
13131313 RegisterMCAsmParser C(getTheSparcelTarget());
4747 }
4848
4949
50 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSparcDisassembler() {
50 extern "C" void LLVMInitializeSparcDisassembler() {
5151 // Register the disassembler.
5252 TargetRegistry::RegisterMCDisassembler(getTheSparcTarget(),
5353 createSparcDisassembler);
8888 return new SparcInstPrinter(MAI, MII, MRI);
8989 }
9090
91 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSparcTargetMC() {
91 extern "C" void LLVMInitializeSparcTargetMC() {
9292 // Register the MC asm info.
9393 RegisterMCAsmInfoFn X(getTheSparcTarget(), createSparcMCAsmInfo);
9494 RegisterMCAsmInfoFn Y(getTheSparcV9Target(), createSparcV9MCAsmInfo);
438438 }
439439
440440 // Force static initialization.
441 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSparcAsmPrinter() {
441 extern "C" void LLVMInitializeSparcAsmPrinter() {
442442 RegisterAsmPrinter X(getTheSparcTarget());
443443 RegisterAsmPrinter Y(getTheSparcV9Target());
444444 RegisterAsmPrinter Z(getTheSparcelTarget());
1919 #include "llvm/Support/TargetRegistry.h"
2020 using namespace llvm;
2121
22 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSparcTarget() {
22 extern "C" void LLVMInitializeSparcTarget() {
2323 // Register the target.
2424 RegisterTargetMachine X(getTheSparcTarget());
2525 RegisterTargetMachine Y(getTheSparcV9Target());
2222 return TheSparcelTarget;
2323 }
2424
25 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSparcTargetInfo() {
25 extern "C" void LLVMInitializeSparcTargetInfo() {
2626 RegisterTarget X(getTheSparcTarget(), "sparc",
2727 "Sparc", "Sparc");
2828 RegisterTarget Y(
13701370 }
13711371
13721372 // Force static initialization.
1373 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZAsmParser() {
1373 extern "C" void LLVMInitializeSystemZAsmParser() {
13741374 RegisterMCAsmParser X(getTheSystemZTarget());
13751375 }
4545 return new SystemZDisassembler(STI, Ctx);
4646 }
4747
48 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZDisassembler() {
48 extern "C" void LLVMInitializeSystemZDisassembler() {
4949 // Register the disassembler.
5050 TargetRegistry::RegisterMCDisassembler(getTheSystemZTarget(),
5151 createSystemZDisassembler);
181181 return new SystemZInstPrinter(MAI, MII, MRI);
182182 }
183183
184 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZTargetMC() {
184 extern "C" void LLVMInitializeSystemZTargetMC() {
185185 // Register the MCAsmInfo.
186186 TargetRegistry::RegisterMCAsmInfo(getTheSystemZTarget(),
187187 createSystemZMCAsmInfo);
643643 }
644644
645645 // Force static initialization.
646 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZAsmPrinter() {
646 extern "C" void LLVMInitializeSystemZAsmPrinter() {
647647 RegisterAsmPrinter X(getTheSystemZTarget());
648648 }
2828
2929 using namespace llvm;
3030
31 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZTarget() {
31 extern "C" void LLVMInitializeSystemZTarget() {
3232 // Register the target.
3333 RegisterTargetMachine X(getTheSystemZTarget());
3434 }
1515 return TheSystemZTarget;
1616 }
1717
18 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZTargetInfo() {
18 extern "C" void LLVMInitializeSystemZTargetInfo() {
1919 RegisterTarget X(
2020 getTheSystemZTarget(), "systemz", "SystemZ", "SystemZ");
2121 }
763763 } // end anonymous namespace
764764
765765 // Force static initialization.
766 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyAsmParser() {
766 extern "C" void LLVMInitializeWebAssemblyAsmParser() {
767767 RegisterMCAsmParser X(getTheWebAssemblyTarget32());
768768 RegisterMCAsmParser Y(getTheWebAssemblyTarget64());
769769 }
6464 return new WebAssemblyDisassembler(STI, Ctx, std::move(MCII));
6565 }
6666
67 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyDisassembler() {
67 extern "C" void LLVMInitializeWebAssemblyDisassembler() {
6868 // Register the disassembler for each target.
6969 TargetRegistry::RegisterMCDisassembler(getTheWebAssemblyTarget32(),
7070 createWebAssemblyDisassembler);
9494 }
9595
9696 // Force static initialization.
97 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyTargetMC() {
97 extern "C" void LLVMInitializeWebAssemblyTargetMC() {
9898 for (Target *T :
9999 {&getTheWebAssemblyTarget32(), &getTheWebAssemblyTarget64()}) {
100100 // Register the MC asm info.
2525 return TheWebAssemblyTarget64;
2626 }
2727
28 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyTargetInfo() {
28 extern "C" void LLVMInitializeWebAssemblyTargetInfo() {
2929 RegisterTarget X(getTheWebAssemblyTarget32(), "wasm32",
3030 "WebAssembly 32-bit", "WebAssembly");
3131 RegisterTarget Y(getTheWebAssemblyTarget64(), "wasm64",
442442 }
443443
444444 // Force static initialization.
445 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyAsmPrinter() {
445 extern "C" void LLVMInitializeWebAssemblyAsmPrinter() {
446446 RegisterAsmPrinter X(getTheWebAssemblyTarget32());
447447 RegisterAsmPrinter Y(getTheWebAssemblyTarget64());
448448 }
4444 cl::desc("WebAssembly Emscripten-style setjmp/longjmp handling"),
4545 cl::init(false));
4646
47 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyTarget() {
47 extern "C" void LLVMInitializeWebAssemblyTarget() {
4848 // Register the target.
4949 RegisterTargetMachine X(
5050 getTheWebAssemblyTarget32());
37083708 }
37093709
37103710 // Force static initialization.
3711 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeX86AsmParser() {
3711 extern "C" void LLVMInitializeX86AsmParser() {
37123712 RegisterMCAsmParser X(getTheX86_32Target());
37133713 RegisterMCAsmParser Y(getTheX86_64Target());
37143714 }
843843 return new X86GenericDisassembler(STI, Ctx, std::move(MII));
844844 }
845845
846 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeX86Disassembler() {
846 extern "C" void LLVMInitializeX86Disassembler() {
847847 // Register the disassembler.
848848 TargetRegistry::RegisterMCDisassembler(getTheX86_32Target(),
849849 createX86Disassembler);
522522 }
523523
524524 // Force static initialization.
525 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeX86TargetMC() {
525 extern "C" void LLVMInitializeX86TargetMC() {
526526 for (Target *T : {&getTheX86_32Target(), &getTheX86_64Target()}) {
527527 // Register the MC asm info.
528528 RegisterMCAsmInfoFn X(*T, createX86MCAsmInfo);
1818 return TheX86_64Target;
1919 }
2020
21 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeX86TargetInfo() {
21 extern "C" void LLVMInitializeX86TargetInfo() {
2222 RegisterTarget X(
2323 getTheX86_32Target(), "x86", "32-bit X86: Pentium-Pro and above", "X86");
2424
726726 //===----------------------------------------------------------------------===//
727727
728728 // Force static initialization.
729 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeX86AsmPrinter() {
729 extern "C" void LLVMInitializeX86AsmPrinter() {
730730 RegisterAsmPrinter X(getTheX86_32Target());
731731 RegisterAsmPrinter Y(getTheX86_64Target());
732732 }
5959 "folding pass"),
6060 cl::init(false), cl::Hidden);
6161
62 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeX86Target() {
62 extern "C" void LLVMInitializeX86Target() {
6363 // Register the target.
6464 RegisterTargetMachine X(getTheX86_32Target());
6565 RegisterTargetMachine Y(getTheX86_64Target());
773773 return new XCoreDisassembler(STI, Ctx);
774774 }
775775
776 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXCoreDisassembler() {
776 extern "C" void LLVMInitializeXCoreDisassembler() {
777777 // Register the disassembler.
778778 TargetRegistry::RegisterMCDisassembler(getTheXCoreTarget(),
779779 createXCoreDisassembler);
120120 }
121121
122122 // Force static initialization.
123 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXCoreTargetMC() {
123 extern "C" void LLVMInitializeXCoreTargetMC() {
124124 // Register the MC asm info.
125125 RegisterMCAsmInfoFn X(getTheXCoreTarget(), createXCoreMCAsmInfo);
126126
1414 return TheXCoreTarget;
1515 }
1616
17 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXCoreTargetInfo() {
17 extern "C" void LLVMInitializeXCoreTargetInfo() {
1818 RegisterTarget X(getTheXCoreTarget(), "xcore", "XCore",
1919 "XCore");
2020 }
291291 }
292292
293293 // Force static initialization.
294 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXCoreAsmPrinter() {
294 extern "C" void LLVMInitializeXCoreAsmPrinter() {
295295 RegisterAsmPrinter X(getTheXCoreTarget());
296296 }
104104 }
105105
106106 // Force static initialization.
107 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXCoreTarget() {
107 extern "C" void LLVMInitializeXCoreTarget() {
108108 RegisterTargetMachine X(getTheXCoreTarget());
109109 }
110110
55 endfunction()
66 function(add_llvm_unittest_with_input_files test_dirname)
77 add_unittest_with_input_files(UnitTests ${test_dirname} ${ARGN})
8 endfunction()
9
10 # The target unittests may test APIs that aren't exported in libLLVM.so, so
11 # we need to always link against the static libraries.
12 function(add_llvm_target_unittest test_dir_name)
13 add_llvm_unittest(${test_dir_name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
148 endfunction()
159
1610 add_subdirectory(ADT)
1616 Target
1717 )
1818
19 add_llvm_target_unittest(AArch64Tests
19 add_llvm_unittest(AArch64Tests
2020 InstSizes.cpp
2121 )
1212 WebAssemblyInfo
1313 )
1414
15 add_llvm_target_unittest(WebAssemblyTests
15 add_llvm_unittest(WebAssemblyTests
1616 WebAssemblyExceptionInfoTest.cpp
1717 )
1212 AArch64
1313 )
1414
15 add_llvm_target_unittest(LLVMExegesisAArch64Tests
15 add_llvm_unittest(LLVMExegesisAArch64Tests
1616 TargetTest.cpp
1717 )
1818 target_link_libraries(LLVMExegesisAArch64Tests PRIVATE
1212 ARM
1313 )
1414
15 add_llvm_target_unittest(LLVMExegesisARMTests
15 add_llvm_unittest(LLVMExegesisARMTests
1616 AssemblerTest.cpp
1717 )
1818 target_link_libraries(LLVMExegesisARMTests PRIVATE LLVMExegesis)
1212 PowerPC
1313 )
1414
15 add_llvm_target_unittest(LLVMExegesisPowerPCTests
15 add_llvm_unittest(LLVMExegesisPowerPCTests
1616 AnalysisTest.cpp
1717 TargetTest.cpp
1818 )
1212 X86
1313 )
1414
15 add_llvm_target_unittest(LLVMExegesisX86Tests
15 add_llvm_unittest(LLVMExegesisX86Tests
1616 AssemblerTest.cpp
1717 BenchmarkResultTest.cpp
1818 RegisterAliasingTest.cpp
7070 )
7171
7272 add_subdirectory(UnitTestMain)
73
74 # When LLVM_LINK_LLVM_DYLIB is enabled, libLLVM.so is added to the interface
75 # link libraries for gtest and gtest_main. This means that any target, like
76 # unittests for example, that links against gtest will be forced to link
77 # against libLLVM.so. In some cases we may want to statically unittests if they
78 # need access to symbols that are marked private in libLLVM.so. The only
79 # way we can make this work is to remove libLLVM.so from the list of interface
80 # link libraries for gtest and then make gtest users responsible for explicitly
81 # adding libLLVM.so to their targets link libraries if they need it.
82
83 function (gtest_remove_dylib_from_link_interface target)
84 get_target_property(interface_libs ${target} INTERFACE_LINK_LIBRARIES)
85 if (interface_libs)
86 list(REMOVE_ITEM interface_libs LLVM)
87 set_target_properties(${target} PROPERTIES INTERFACE_LINK_LIBRARIES "${interface_libs}")
88 endif()
89 endfunction()
90
91 gtest_remove_dylib_from_link_interface(gtest)
92 gtest_remove_dylib_from_link_interface(gtest_main)