1 //===- TargetSelect.h -----------------------------------------------------===// 2 // 3 // The MCLinker Project 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 #ifndef MCLD_TARGET_SELECT_H 10 #define MCLD_TARGET_SELECT_H 11 #ifdef ENABLE_UNITTEST 12 #include <gtest.h> 13 #endif 14 15 extern "C" { 16 // Declare all of the target-initialization functions that are available. 17 #define MCLD_TARGET(TargetName) void MCLDInitialize##TargetName##LDTargetInfo(); 18 #include "mcld/Config/Targets.def" 19 20 // Declare all of the target-dependent functions that are available. 21 #define MCLD_TARGET(TargetName) void MCLDInitialize##TargetName##LDTarget(); 22 #include "mcld/Config/Targets.def" 23 24 // Declare all of the target-depedent linker information 25 #define MCLD_LINKER(TargetName) void MCLDInitialize##TargetName##LDInfo(); 26 #include "mcld/Config/Linkers.def" 27 28 // Declare all of the available linker environment. 29 #define MCLD_LINKER(TargetName) void MCLDInitialize##TargetName##MCLinker(); 30 #include "mcld/Config/Linkers.def" 31 32 // Declare all of the available emulators. 33 #define MCLD_TARGET(TargetName) void MCLDInitialize##TargetName##Emulation(); 34 #include "mcld/Config/Targets.def" 35 36 // Declare all of the available target-specific linker 37 #define MCLD_LINKER(TargetName) void MCLDInitialize##TargetName##LDBackend(); 38 #include "mcld/Config/Linkers.def" 39 40 // Declare all of the available target-specific diagnostic line infomation 41 #define MCLD_LINKER(TargetName) void MCLDInitialize##TargetName##DiagnosticLineInfo(); 42 #include "mcld/Config/Linkers.def" 43 44 } // extern "C" 45 46 namespace mcld 47 { 48 /// InitializeAllTargetInfos - The main program should call this function if 49 /// it wants access to all available targets that MCLD is configured to 50 /// support, to make them available via the TargetRegistry. 51 /// 52 /// It is legal for a client to make multiple calls to this function. 53 inline void InitializeAllTargetInfos() { 54 #define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##LDTargetInfo(); 55 #include "mcld/Config/Targets.def" 56 } 57 58 /// InitializeAllTargets - The main program should call this function if it 59 /// wants access to all available target machines that MCLD is configured to 60 /// support, to make them available via the TargetRegistry. 61 /// 62 /// It is legal for a client to make multiple calls to this function. 63 inline void InitializeAllTargets() { 64 mcld::InitializeAllTargetInfos(); 65 66 #define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##LDBackend(); 67 #include "mcld/Config/Targets.def" 68 } 69 70 /// InitializeAllEmulations - The main program should call this function if 71 /// it wants all emulations to be configured to support. This function makes 72 /// all emulations available via the TargetRegistry. 73 inline void InitializeAllEmulations() { 74 #define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##Emulation(); 75 #include "mcld/Config/Targets.def" 76 } 77 78 /// InitializeAllLinkers - The main program should call this function if it 79 /// wants all linkers that is configured to support, to make them 80 /// available via the TargetRegistry. 81 /// 82 /// It is legal for a client to make multiple calls to this function. 83 inline void InitializeAllLinkers() { 84 #define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##LDTarget(); 85 #include "mcld/Config/Targets.def" 86 87 #define MCLD_LINKER(TargetName) MCLDInitialize##TargetName##MCLinker(); 88 #include "mcld/Config/Linkers.def" 89 } 90 91 /// InitializeMsgHandler - The main program should call this function if it 92 /// wants to print linker-specific messages. To make them available via the 93 /// TargetRegistry. 94 inline void InitializeAllDiagnostics() { 95 #define MCLD_LINKER(TargetName) MCLDInitialize##TargetName##DiagnosticLineInfo(); 96 #include "mcld/Config/Linkers.def" 97 } 98 99 } // namespace of mcld 100 101 #endif 102 103