• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##LDTargetInfo();
18 #include "mcld/Config/Targets.def"
19 
20   // Declare all of the target-dependent functions that are available.
21 #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##LDTarget();
22 #include "mcld/Config/Targets.def"
23 
24   // Declare all of the target-depedent linker information
25 #define LLVM_LINKER(TargetName) void LLVMInitialize##TargetName##LDInfo();
26 #include "mcld/Config/Linkers.def"
27 
28   // Declare all of the available linker environment.
29 #define LLVM_LINKER(TargetName) void LLVMInitialize##TargetName##SectLinker();
30 #include "mcld/Config/Linkers.def"
31 
32   // Declare all of the available target-specific linker
33 #define LLVM_LINKER(TargetName) void LLVMInitialize##TargetName##LDBackend();
34 #include "mcld/Config/Linkers.def"
35 
36   // Declare all of the available target-specific diagnostic line infomation
37 #define LLVM_LINKER(TargetName) void LLVMInitialize##TargetName##DiagnosticLineInfo();
38 #include "mcld/Config/Linkers.def"
39 
40 } // extern "C"
41 
42 namespace mcld
43 {
44   /// InitializeAllTargetInfos - The main program should call this function if
45   /// it wants access to all available targets that LLVM is configured to
46   /// support, to make them available via the TargetRegistry.
47   ///
48   /// It is legal for a client to make multiple calls to this function.
InitializeAllTargetInfos()49   inline void InitializeAllTargetInfos() {
50 #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##LDTargetInfo();
51 #include "mcld/Config/Targets.def"
52   }
53 
54   /// InitializeAllTargets - The main program should call this function if it
55   /// wants access to all available target machines that LLVM is configured to
56   /// support, to make them available via the TargetRegistry.
57   ///
58   /// It is legal for a client to make multiple calls to this function.
InitializeAllTargets()59   inline void InitializeAllTargets() {
60     mcld::InitializeAllTargetInfos();
61 
62 #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##LDTarget();
63 #include "mcld/Config/Targets.def"
64 
65 #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##LDBackend();
66 #include "mcld/Config/Targets.def"
67   }
68 
69   /// InitializeAllLinkers - The main program should call this function if it
70   /// wants all linkers that LLVM is configured to support, to make them
71   /// available via the TargetRegistry.
72   ///
73   /// It is legal for a client to make multiple calls to this function.
InitializeAllLinkers()74   inline void InitializeAllLinkers() {
75 #define LLVM_LINKER(TargetName) LLVMInitialize##TargetName##SectLinker();
76 #include "mcld/Config/Linkers.def"
77   }
78 
79   /// InitializeMsgHandler - The main program should call this function if it
80   /// wants to print linker-specific messages. To make them available via the
81   /// TargetRegistry.
InitializeAllDiagnostics()82   inline void InitializeAllDiagnostics() {
83 #define LLVM_LINKER(TargetName)  LLVMInitialize##TargetName##DiagnosticLineInfo();
84 #include "mcld/Config/Linkers.def"
85   }
86 
87 } // namespace of mcld
88 
89 #endif
90 
91