LCOV - code coverage report
Current view: top level - include/llvm/Support - TargetSelect.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 18 19 94.7 %
Date: 2018-10-20 13:21:21 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- TargetSelect.h - Target Selection & Registration ---------*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file provides utilities to make sure that certain classes of targets are
      11             : // linked into the main application executable, and initialize them as
      12             : // appropriate.
      13             : //
      14             : //===----------------------------------------------------------------------===//
      15             : 
      16             : #ifndef LLVM_SUPPORT_TARGETSELECT_H
      17             : #define LLVM_SUPPORT_TARGETSELECT_H
      18             : 
      19             : #include "llvm/Config/llvm-config.h"
      20             : 
      21             : extern "C" {
      22             :   // Declare all of the target-initialization functions that are available.
      23             : #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##TargetInfo();
      24             : #include "llvm/Config/Targets.def"
      25             : 
      26             : #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target();
      27             : #include "llvm/Config/Targets.def"
      28             : 
      29             :   // Declare all of the target-MC-initialization functions that are available.
      30             : #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##TargetMC();
      31             : #include "llvm/Config/Targets.def"
      32             : 
      33             :   // Declare all of the available assembly printer initialization functions.
      34             : #define LLVM_ASM_PRINTER(TargetName) void LLVMInitialize##TargetName##AsmPrinter();
      35             : #include "llvm/Config/AsmPrinters.def"
      36             : 
      37             :   // Declare all of the available assembly parser initialization functions.
      38             : #define LLVM_ASM_PARSER(TargetName) void LLVMInitialize##TargetName##AsmParser();
      39             : #include "llvm/Config/AsmParsers.def"
      40             : 
      41             :   // Declare all of the available disassembler initialization functions.
      42             : #define LLVM_DISASSEMBLER(TargetName) \
      43             :   void LLVMInitialize##TargetName##Disassembler();
      44             : #include "llvm/Config/Disassemblers.def"
      45             : }
      46             : 
      47             : namespace llvm {
      48             :   /// InitializeAllTargetInfos - The main program should call this function if
      49             :   /// it wants access to all available targets that LLVM 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      127874 :   inline void InitializeAllTargetInfos() {
      54             : #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo();
      55             : #include "llvm/Config/Targets.def"
      56      127874 :   }
      57             : 
      58             :   /// InitializeAllTargets - The main program should call this function if it
      59             :   /// wants access to all available target machines that LLVM 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      113919 :   inline void InitializeAllTargets() {
      64             :     // FIXME: Remove this, clients should do it.
      65      113919 :     InitializeAllTargetInfos();
      66             : 
      67             : #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target();
      68             : #include "llvm/Config/Targets.def"
      69      113919 :   }
      70             : 
      71             :   /// InitializeAllTargetMCs - The main program should call this function if it
      72             :   /// wants access to all available target MC that LLVM is configured to
      73             :   /// support, to make them available via the TargetRegistry.
      74             :   ///
      75             :   /// It is legal for a client to make multiple calls to this function.
      76       79014 :   inline void InitializeAllTargetMCs() {
      77             : #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetMC();
      78             : #include "llvm/Config/Targets.def"
      79       79014 :   }
      80             : 
      81             :   /// InitializeAllAsmPrinters - The main program should call this function if
      82             :   /// it wants all asm printers that LLVM is configured to support, to make them
      83             :   /// available via the TargetRegistry.
      84             :   ///
      85             :   /// It is legal for a client to make multiple calls to this function.
      86       65841 :   inline void InitializeAllAsmPrinters() {
      87             : #define LLVM_ASM_PRINTER(TargetName) LLVMInitialize##TargetName##AsmPrinter();
      88             : #include "llvm/Config/AsmPrinters.def"
      89       65841 :   }
      90             : 
      91             :   /// InitializeAllAsmParsers - The main program should call this function if it
      92             :   /// wants all asm parsers that LLVM is configured to support, to make them
      93             :   /// available via the TargetRegistry.
      94             :   ///
      95             :   /// It is legal for a client to make multiple calls to this function.
      96       75416 :   inline void InitializeAllAsmParsers() {
      97             : #define LLVM_ASM_PARSER(TargetName) LLVMInitialize##TargetName##AsmParser();
      98             : #include "llvm/Config/AsmParsers.def"
      99       75416 :   }
     100             : 
     101             :   /// InitializeAllDisassemblers - The main program should call this function if
     102             :   /// it wants all disassemblers that LLVM is configured to support, to make
     103             :   /// them available via the TargetRegistry.
     104             :   ///
     105             :   /// It is legal for a client to make multiple calls to this function.
     106       10842 :   inline void InitializeAllDisassemblers() {
     107             : #define LLVM_DISASSEMBLER(TargetName) LLVMInitialize##TargetName##Disassembler();
     108             : #include "llvm/Config/Disassemblers.def"
     109       10842 :   }
     110             : 
     111             :   /// InitializeNativeTarget - The main program should call this function to
     112             :   /// initialize the native target corresponding to the host.  This is useful
     113             :   /// for JIT applications to ensure that the target gets linked in correctly.
     114             :   ///
     115             :   /// It is legal for a client to make multiple calls to this function.
     116             :   inline bool InitializeNativeTarget() {
     117             :   // If we have a native target, initialize it to ensure it is linked in.
     118             : #ifdef LLVM_NATIVE_TARGET
     119         248 :     LLVM_NATIVE_TARGETINFO();
     120         248 :     LLVM_NATIVE_TARGET();
     121         248 :     LLVM_NATIVE_TARGETMC();
     122             :     return false;
     123             : #else
     124             :     return true;
     125             : #endif
     126             :   }
     127             : 
     128             :   /// InitializeNativeTargetAsmPrinter - The main program should call
     129             :   /// this function to initialize the native target asm printer.
     130             :   inline bool InitializeNativeTargetAsmPrinter() {
     131             :   // If we have a native target, initialize the corresponding asm printer.
     132             : #ifdef LLVM_NATIVE_ASMPRINTER
     133         248 :     LLVM_NATIVE_ASMPRINTER();
     134             :     return false;
     135             : #else
     136             :     return true;
     137             : #endif
     138             :   }
     139             : 
     140             :   /// InitializeNativeTargetAsmParser - The main program should call
     141             :   /// this function to initialize the native target asm parser.
     142             :   inline bool InitializeNativeTargetAsmParser() {
     143             :   // If we have a native target, initialize the corresponding asm parser.
     144             : #ifdef LLVM_NATIVE_ASMPARSER
     145         214 :     LLVM_NATIVE_ASMPARSER();
     146             :     return false;
     147             : #else
     148             :     return true;
     149             : #endif
     150             :   }
     151             : 
     152             :   /// InitializeNativeTargetDisassembler - The main program should call
     153             :   /// this function to initialize the native target disassembler.
     154             :   inline bool InitializeNativeTargetDisassembler() {
     155             :   // If we have a native target, initialize the corresponding disassembler.
     156             : #ifdef LLVM_NATIVE_DISASSEMBLER
     157           0 :     LLVM_NATIVE_DISASSEMBLER();
     158             :     return false;
     159             : #else
     160             :     return true;
     161             : #endif
     162             :   }
     163             : }
     164             : 
     165             : #endif

Generated by: LCOV version 1.13