Project Alice
Loading...
Searching...
No Matches
Target.h
Go to the documentation of this file.
1/*===-- llvm-c/Target.h - Target Lib C Iface --------------------*- C++ -*-===*/
2/* */
3/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
4/* Exceptions. */
5/* See https://llvm.org/LICENSE.txt for license information. */
6/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
7/* */
8/*===----------------------------------------------------------------------===*/
9/* */
10/* This header declares the C interface to libLLVMTarget.a, which */
11/* implements target information. */
12/* */
13/* Many exotic languages can interoperate with C code but have a harder time */
14/* with C++ due to name mangling. So in addition to C, this interface enables */
15/* tools written in such languages. */
16/* */
17/*===----------------------------------------------------------------------===*/
18
19#ifndef LLVM_C_TARGET_H
20#define LLVM_C_TARGET_H
21
22#include "llvm-c/ExternC.h"
23#include "llvm-c/Types.h"
25
27
36
37typedef struct LLVMOpaqueTargetData *LLVMTargetDataRef;
38typedef struct LLVMOpaqueTargetLibraryInfotData *LLVMTargetLibraryInfoRef;
39
40/* Declare all of the target-initialization functions that are available. */
41#define LLVM_TARGET(TargetName) \
42 void LLVMInitialize##TargetName##TargetInfo(void);
43#include "llvm/Config/Targets.def"
44#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
45
46#define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target(void);
47#include "llvm/Config/Targets.def"
48#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
49
50#define LLVM_TARGET(TargetName) \
51 void LLVMInitialize##TargetName##TargetMC(void);
52#include "llvm/Config/Targets.def"
53#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
54
55/* Declare all of the available assembly printer initialization functions. */
56#define LLVM_ASM_PRINTER(TargetName) \
57 void LLVMInitialize##TargetName##AsmPrinter(void);
58#include "llvm/Config/AsmPrinters.def"
59#undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */
60
61/* Declare all of the available assembly parser initialization functions. */
62#define LLVM_ASM_PARSER(TargetName) \
63 void LLVMInitialize##TargetName##AsmParser(void);
64#include "llvm/Config/AsmParsers.def"
65#undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */
66
67/* Declare all of the available disassembler initialization functions. */
68#define LLVM_DISASSEMBLER(TargetName) \
69 void LLVMInitialize##TargetName##Disassembler(void);
70#include "llvm/Config/Disassemblers.def"
71#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */
72
76static inline void LLVMInitializeAllTargetInfos(void) {
77#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo();
78#include "llvm/Config/Targets.def"
79#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
80}
81
85static inline void LLVMInitializeAllTargets(void) {
86#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target();
87#include "llvm/Config/Targets.def"
88#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
89}
90
94static inline void LLVMInitializeAllTargetMCs(void) {
95#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetMC();
96#include "llvm/Config/Targets.def"
97#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
98}
99
103static inline void LLVMInitializeAllAsmPrinters(void) {
104#define LLVM_ASM_PRINTER(TargetName) LLVMInitialize##TargetName##AsmPrinter();
105#include "llvm/Config/AsmPrinters.def"
106#undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */
107}
108
112static inline void LLVMInitializeAllAsmParsers(void) {
113#define LLVM_ASM_PARSER(TargetName) LLVMInitialize##TargetName##AsmParser();
114#include "llvm/Config/AsmParsers.def"
115#undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */
116}
117
121static inline void LLVMInitializeAllDisassemblers(void) {
122#define LLVM_DISASSEMBLER(TargetName) \
123 LLVMInitialize##TargetName##Disassembler();
124#include "llvm/Config/Disassemblers.def"
125#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */
126}
127
131static inline LLVMBool LLVMInitializeNativeTarget(void) {
132 /* If we have a native target, initialize it to ensure it is linked in. */
133#ifdef LLVM_NATIVE_TARGET
137 return 0;
138#else
139 return 1;
140#endif
141}
142
146static inline LLVMBool LLVMInitializeNativeAsmParser(void) {
147#ifdef LLVM_NATIVE_ASMPARSER
149 return 0;
150#else
151 return 1;
152#endif
153}
154
158static inline LLVMBool LLVMInitializeNativeAsmPrinter(void) {
159#ifdef LLVM_NATIVE_ASMPRINTER
161 return 0;
162#else
163 return 1;
164#endif
165}
166
170static inline LLVMBool LLVMInitializeNativeDisassembler(void) {
171#ifdef LLVM_NATIVE_DISASSEMBLER
173 return 0;
174#else
175 return 1;
176#endif
177}
178
179/*===-- Target Data -------------------------------------------------------===*/
180
187
194
198
202
208
213
218
222
226unsigned LLVMPointerSizeForAS(LLVMTargetDataRef TD, unsigned AS);
227
231
236
240
245 unsigned AS);
246
250
254
258
262
266
270
274 LLVMValueRef GlobalVar);
275
279 unsigned long long Offset);
280
284 LLVMTypeRef StructTy, unsigned Element);
285
291
292#endif
#define LLVM_C_EXTERN_C_BEGIN
Definition: ExternC.h:35
#define LLVM_C_EXTERN_C_END
Definition: ExternC.h:36
#define C(name, bit)
Definition: cpu.h:242
struct LLVMOpaqueValue * LLVMValueRef
Definition: Types.h:75
int LLVMBool
Definition: Types.h:28
struct LLVMOpaquePassManager * LLVMPassManagerRef
Definition: Types.h:127
struct LLVMOpaqueContext * LLVMContextRef
Definition: Types.h:53
struct LLVMOpaqueType * LLVMTypeRef
Definition: Types.h:68
struct LLVMOpaqueModule * LLVMModuleRef
Definition: Types.h:61
void LLVMSetModuleDataLayout(LLVMModuleRef M, LLVMTargetDataRef DL)
LLVMTargetDataRef LLVMGetModuleDataLayout(LLVMModuleRef M)
unsigned LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef TD, LLVMValueRef GlobalVar)
void LLVMDisposeTargetData(LLVMTargetDataRef TD)
char * LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD)
LLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef C, LLVMTargetDataRef TD)
LLVMByteOrdering
Definition: Target.h:35
unsigned LLVMABIAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
unsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
enum LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef TD)
LLVMTypeRef LLVMIntPtrType(LLVMTargetDataRef TD)
unsigned LLVMPointerSizeForAS(LLVMTargetDataRef TD, unsigned AS)
unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
unsigned long long LLVMOffsetOfElement(LLVMTargetDataRef TD, LLVMTypeRef StructTy, unsigned Element)
unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef TD, LLVMTypeRef Ty)
void LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef TLI, LLVMPassManagerRef PM)
struct LLVMOpaqueTargetLibraryInfotData * LLVMTargetLibraryInfoRef
Definition: Target.h:38
unsigned LLVMPointerSize(LLVMTargetDataRef TD)
LLVMTypeRef LLVMIntPtrTypeForAS(LLVMTargetDataRef TD, unsigned AS)
unsigned long long LLVMABISizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
LLVMTargetDataRef LLVMCreateTargetData(const char *StringRep)
struct LLVMOpaqueTargetData * LLVMTargetDataRef
Definition: Target.h:37
LLVMTypeRef LLVMIntPtrTypeForASInContext(LLVMContextRef C, LLVMTargetDataRef TD, unsigned AS)
unsigned LLVMElementAtOffset(LLVMTargetDataRef TD, LLVMTypeRef StructTy, unsigned long long Offset)
unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty)
@ LLVMBigEndian
Definition: Target.h:35
@ LLVMLittleEndian
Definition: Target.h:35
#define LLVM_NATIVE_ASMPARSER
Definition: llvm-config.h:37
#define LLVM_NATIVE_TARGETMC
Definition: llvm-config.h:52
#define LLVM_NATIVE_TARGET
Definition: llvm-config.h:46
#define LLVM_NATIVE_TARGETINFO
Definition: llvm-config.h:49
#define LLVM_NATIVE_DISASSEMBLER
Definition: llvm-config.h:43
#define LLVM_NATIVE_ASMPRINTER
Definition: llvm-config.h:40