Home | History | Annotate | Download | only in Support
      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 TARGETSELECT_H
     10 #define TARGETSELECT_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 } // extern "C"
     36 
     37 namespace mcld
     38 {
     39   /// InitializeAllTargetInfos - The main program should call this function if
     40   /// it wants access to all available targets that LLVM is configured to
     41   /// support, to make them available via the TargetRegistry.
     42   ///
     43   /// It is legal for a client to make multiple calls to this function.
     44   inline void InitializeAllTargetInfos() {
     45 #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##LDTargetInfo();
     46 #include "mcld/Config/Targets.def"
     47   }
     48 
     49   /// InitializeAllTargets - The main program should call this function if it
     50   /// wants access to all available target machines that LLVM is configured to
     51   /// support, to make them available via the TargetRegistry.
     52   ///
     53   /// It is legal for a client to make multiple calls to this function.
     54   inline void InitializeAllTargets() {
     55     mcld::InitializeAllTargetInfos();
     56 
     57 #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##LDTarget();
     58 #include "mcld/Config/Targets.def"
     59   }
     60 
     61   /// InitializeAllLinkers - The main program should call this function if it
     62   /// wants all linkers that LLVM is configured to support, to make them
     63   /// available via the TargetRegistry.
     64   ///
     65   /// It is legal for a client to make multiple calls to this function.
     66   inline void InitializeAllLinkers() {
     67 #define LLVM_LINKER(TargetName) LLVMInitialize##TargetName##SectLinker();
     68 #include "mcld/Config/Linkers.def"
     69 
     70 #define LLVM_LINKER(TargetName) LLVMInitialize##TargetName##LDBackend();
     71 #include "mcld/Config/Linkers.def"
     72   }
     73 
     74 } // namespace of mcld
     75 
     76 #endif
     77 
     78