remove TargetAsmInfo::ExpandInlineAsm
[oota-llvm.git] / include / llvm / Target / TargetSelect.h
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_TARGET_TARGETSELECT_H
17 #define LLVM_TARGET_TARGETSELECT_H
18
19 #include "llvm/Config/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 available assembly printer initialization functions.
30 #define LLVM_ASM_PRINTER(TargetName) void LLVMInitialize##TargetName##AsmPrinter();
31 #include "llvm/Config/AsmPrinters.def"
32
33   // Declare all of the available assembly parser initialization functions.
34 #define LLVM_ASM_PARSER(TargetName) void LLVMInitialize##TargetName##AsmParser();
35 #include "llvm/Config/AsmParsers.def"
36 }
37
38 namespace llvm {
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##TargetInfo();
46 #include "llvm/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     // FIXME: Remove this, clients should do it.
56     InitializeAllTargetInfos();
57
58 #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target();
59 #include "llvm/Config/Targets.def"
60   }
61   
62   /// InitializeAllAsmPrinters - The main program should call this function if
63   /// it wants all asm printers that LLVM is configured to support, to make them
64   /// available via the TargetRegistry.
65   ///
66   /// It is legal for a client to make multiple calls to this function.
67   inline void InitializeAllAsmPrinters() {
68 #define LLVM_ASM_PRINTER(TargetName) LLVMInitialize##TargetName##AsmPrinter();
69 #include "llvm/Config/AsmPrinters.def"
70   }
71   
72   /// InitializeAllAsmParsers - The main program should call this function if it
73   /// wants all asm parsers that LLVM is configured to support, to make them
74   /// available via the TargetRegistry.
75   ///
76   /// It is legal for a client to make multiple calls to this function.
77   inline void InitializeAllAsmParsers() {
78 #define LLVM_ASM_PARSER(TargetName) LLVMInitialize##TargetName##AsmParser();
79 #include "llvm/Config/AsmParsers.def"
80   }
81   
82   /// InitializeNativeTarget - The main program should call this function to
83   /// initialize the native target corresponding to the host.  This is useful 
84   /// for JIT applications to ensure that the target gets linked in correctly.
85   ///
86   /// It is legal for a client to make multiple calls to this function.
87   inline bool InitializeNativeTarget() {
88   // If we have a native target, initialize it to ensure it is linked in.
89 #ifdef LLVM_NATIVE_ARCH
90 #define DoInit2(TARG) \
91     LLVMInitialize ## TARG ## Info ();          \
92     LLVMInitialize ## TARG ()
93 #define DoInit(T) DoInit2(T)
94     DoInit(LLVM_NATIVE_ARCH);
95     return false;
96 #undef DoInit
97 #undef DoInit2
98 #else
99     return true;
100 #endif
101   }  
102 }
103
104 #endif