Eric Christopher | f24446d | 2010-08-08 02:44:17 +0000 | [diff] [blame] | 1 | /*===-- llvm-c/Target.h - Target Lib C Iface --------------------*- C++ -*-===*/ |
| 2 | /* */ |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 */ |
Eric Christopher | f24446d | 2010-08-08 02:44:17 +0000 | [diff] [blame] | 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 | /*===----------------------------------------------------------------------===*/ |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 18 | |
| 19 | #ifndef LLVM_C_TARGET_H |
| 20 | #define LLVM_C_TARGET_H |
| 21 | |
Eric Christopher | a6b9600 | 2015-12-18 01:46:52 +0000 | [diff] [blame] | 22 | #include "llvm-c/Types.h" |
Eric Christopher | f24446d | 2010-08-08 02:44:17 +0000 | [diff] [blame] | 23 | #include "llvm/Config/llvm-config.h" |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 24 | |
| 25 | #ifdef __cplusplus |
| 26 | extern "C" { |
| 27 | #endif |
| 28 | |
Gregory Szorc | 34c863a | 2012-03-21 03:54:29 +0000 | [diff] [blame] | 29 | /** |
| 30 | * @defgroup LLVMCTarget Target information |
| 31 | * @ingroup LLVMC |
| 32 | * |
| 33 | * @{ |
| 34 | */ |
| 35 | |
Chris Lattner | 25963c6 | 2010-01-09 22:27:07 +0000 | [diff] [blame] | 36 | enum LLVMByteOrdering { LLVMBigEndian, LLVMLittleEndian }; |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 37 | |
| 38 | typedef struct LLVMOpaqueTargetData *LLVMTargetDataRef; |
Rafael Espindola | e96fd5a | 2011-07-25 21:20:54 +0000 | [diff] [blame] | 39 | typedef struct LLVMOpaqueTargetLibraryInfotData *LLVMTargetLibraryInfoRef; |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 40 | |
Bob Wilson | 5a495fe | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 41 | /* Declare all of the target-initialization functions that are available. */ |
Eric Christopher | 135de90 | 2010-07-12 05:13:35 +0000 | [diff] [blame] | 42 | #define LLVM_TARGET(TargetName) \ |
| 43 | void LLVMInitialize##TargetName##TargetInfo(void); |
Daniel Dunbar | f4e7b6c | 2009-08-18 03:03:27 +0000 | [diff] [blame] | 44 | #include "llvm/Config/Targets.def" |
Chris Lattner | a0a51c7 | 2009-12-21 07:52:40 +0000 | [diff] [blame] | 45 | #undef LLVM_TARGET /* Explicit undef to make SWIG happier */ |
NAKAMURA Takumi | a3a8135 | 2013-10-23 17:56:29 +0000 | [diff] [blame] | 46 | |
Chris Lattner | ee3576e | 2010-04-28 20:24:45 +0000 | [diff] [blame] | 47 | #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target(void); |
Bob Wilson | 5a495fe | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 48 | #include "llvm/Config/Targets.def" |
Chris Lattner | a0a51c7 | 2009-12-21 07:52:40 +0000 | [diff] [blame] | 49 | #undef LLVM_TARGET /* Explicit undef to make SWIG happier */ |
Bob Wilson | 5a495fe | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 50 | |
Evan Cheng | 1705ab0 | 2011-07-14 23:50:31 +0000 | [diff] [blame] | 51 | #define LLVM_TARGET(TargetName) \ |
Evan Cheng | 8c886a4 | 2011-07-22 21:58:54 +0000 | [diff] [blame] | 52 | void LLVMInitialize##TargetName##TargetMC(void); |
Evan Cheng | 2129f59 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 53 | #include "llvm/Config/Targets.def" |
| 54 | #undef LLVM_TARGET /* Explicit undef to make SWIG happier */ |
NAKAMURA Takumi | a3a8135 | 2013-10-23 17:56:29 +0000 | [diff] [blame] | 55 | |
Daniel Dunbar | 69987ab | 2011-11-29 00:06:55 +0000 | [diff] [blame] | 56 | /* Declare all of the available assembly printer initialization functions. */ |
| 57 | #define LLVM_ASM_PRINTER(TargetName) \ |
Anders Waldenborg | 38ce861 | 2012-05-02 16:15:32 +0000 | [diff] [blame] | 58 | void LLVMInitialize##TargetName##AsmPrinter(void); |
Daniel Dunbar | 69987ab | 2011-11-29 00:06:55 +0000 | [diff] [blame] | 59 | #include "llvm/Config/AsmPrinters.def" |
Bill Wendling | 12a98c9 | 2012-03-26 22:15:12 +0000 | [diff] [blame] | 60 | #undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */ |
Daniel Dunbar | 69987ab | 2011-11-29 00:06:55 +0000 | [diff] [blame] | 61 | |
| 62 | /* Declare all of the available assembly parser initialization functions. */ |
| 63 | #define LLVM_ASM_PARSER(TargetName) \ |
Anders Waldenborg | 38ce861 | 2012-05-02 16:15:32 +0000 | [diff] [blame] | 64 | void LLVMInitialize##TargetName##AsmParser(void); |
Daniel Dunbar | 69987ab | 2011-11-29 00:06:55 +0000 | [diff] [blame] | 65 | #include "llvm/Config/AsmParsers.def" |
Bill Wendling | 12a98c9 | 2012-03-26 22:15:12 +0000 | [diff] [blame] | 66 | #undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */ |
Daniel Dunbar | 69987ab | 2011-11-29 00:06:55 +0000 | [diff] [blame] | 67 | |
| 68 | /* Declare all of the available disassembler initialization functions. */ |
| 69 | #define LLVM_DISASSEMBLER(TargetName) \ |
Anders Waldenborg | 38ce861 | 2012-05-02 16:15:32 +0000 | [diff] [blame] | 70 | void LLVMInitialize##TargetName##Disassembler(void); |
Daniel Dunbar | 69987ab | 2011-11-29 00:06:55 +0000 | [diff] [blame] | 71 | #include "llvm/Config/Disassemblers.def" |
Bill Wendling | 12a98c9 | 2012-03-26 22:15:12 +0000 | [diff] [blame] | 72 | #undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */ |
NAKAMURA Takumi | a3a8135 | 2013-10-23 17:56:29 +0000 | [diff] [blame] | 73 | |
Daniel Dunbar | f4e7b6c | 2009-08-18 03:03:27 +0000 | [diff] [blame] | 74 | /** LLVMInitializeAllTargetInfos - The main program should call this function if |
| 75 | it wants access to all available targets that LLVM is configured to |
| 76 | support. */ |
Anders Waldenborg | 0c3b653 | 2013-10-15 13:04:27 +0000 | [diff] [blame] | 77 | static inline void LLVMInitializeAllTargetInfos(void) { |
| 78 | #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo(); |
| 79 | #include "llvm/Config/Targets.def" |
| 80 | #undef LLVM_TARGET /* Explicit undef to make SWIG happier */ |
| 81 | } |
Daniel Dunbar | f4e7b6c | 2009-08-18 03:03:27 +0000 | [diff] [blame] | 82 | |
Bob Wilson | 5a495fe | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 83 | /** LLVMInitializeAllTargets - The main program should call this function if it |
| 84 | wants to link in all available targets that LLVM is configured to |
| 85 | support. */ |
Anders Waldenborg | 0c3b653 | 2013-10-15 13:04:27 +0000 | [diff] [blame] | 86 | static inline void LLVMInitializeAllTargets(void) { |
| 87 | #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target(); |
| 88 | #include "llvm/Config/Targets.def" |
| 89 | #undef LLVM_TARGET /* Explicit undef to make SWIG happier */ |
| 90 | } |
Daniel Dunbar | 69987ab | 2011-11-29 00:06:55 +0000 | [diff] [blame] | 91 | |
| 92 | /** LLVMInitializeAllTargetMCs - The main program should call this function if |
| 93 | it wants access to all available target MC that LLVM is configured to |
| 94 | support. */ |
Anders Waldenborg | 0c3b653 | 2013-10-15 13:04:27 +0000 | [diff] [blame] | 95 | static inline void LLVMInitializeAllTargetMCs(void) { |
| 96 | #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetMC(); |
| 97 | #include "llvm/Config/Targets.def" |
| 98 | #undef LLVM_TARGET /* Explicit undef to make SWIG happier */ |
| 99 | } |
NAKAMURA Takumi | a3a8135 | 2013-10-23 17:56:29 +0000 | [diff] [blame] | 100 | |
Daniel Dunbar | 69987ab | 2011-11-29 00:06:55 +0000 | [diff] [blame] | 101 | /** LLVMInitializeAllAsmPrinters - The main program should call this function if |
| 102 | it wants all asm printers that LLVM is configured to support, to make them |
| 103 | available via the TargetRegistry. */ |
Anders Waldenborg | 0c3b653 | 2013-10-15 13:04:27 +0000 | [diff] [blame] | 104 | static inline void LLVMInitializeAllAsmPrinters(void) { |
| 105 | #define LLVM_ASM_PRINTER(TargetName) LLVMInitialize##TargetName##AsmPrinter(); |
| 106 | #include "llvm/Config/AsmPrinters.def" |
| 107 | #undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */ |
| 108 | } |
NAKAMURA Takumi | a3a8135 | 2013-10-23 17:56:29 +0000 | [diff] [blame] | 109 | |
Daniel Dunbar | 69987ab | 2011-11-29 00:06:55 +0000 | [diff] [blame] | 110 | /** LLVMInitializeAllAsmParsers - The main program should call this function if |
| 111 | it wants all asm parsers that LLVM is configured to support, to make them |
| 112 | available via the TargetRegistry. */ |
Anders Waldenborg | 0c3b653 | 2013-10-15 13:04:27 +0000 | [diff] [blame] | 113 | static inline void LLVMInitializeAllAsmParsers(void) { |
| 114 | #define LLVM_ASM_PARSER(TargetName) LLVMInitialize##TargetName##AsmParser(); |
| 115 | #include "llvm/Config/AsmParsers.def" |
| 116 | #undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */ |
| 117 | } |
NAKAMURA Takumi | a3a8135 | 2013-10-23 17:56:29 +0000 | [diff] [blame] | 118 | |
Daniel Dunbar | 69987ab | 2011-11-29 00:06:55 +0000 | [diff] [blame] | 119 | /** LLVMInitializeAllDisassemblers - The main program should call this function |
| 120 | if it wants all disassemblers that LLVM is configured to support, to make |
| 121 | them available via the TargetRegistry. */ |
Anders Waldenborg | 0c3b653 | 2013-10-15 13:04:27 +0000 | [diff] [blame] | 122 | static inline void LLVMInitializeAllDisassemblers(void) { |
| 123 | #define LLVM_DISASSEMBLER(TargetName) \ |
| 124 | LLVMInitialize##TargetName##Disassembler(); |
| 125 | #include "llvm/Config/Disassemblers.def" |
| 126 | #undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */ |
| 127 | } |
NAKAMURA Takumi | a3a8135 | 2013-10-23 17:56:29 +0000 | [diff] [blame] | 128 | |
Bob Wilson | 5a495fe | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 129 | /** LLVMInitializeNativeTarget - The main program should call this function to |
NAKAMURA Takumi | a3a8135 | 2013-10-23 17:56:29 +0000 | [diff] [blame] | 130 | initialize the native target corresponding to the host. This is useful |
Bob Wilson | 5a495fe | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 131 | for JIT applications to ensure that the target gets linked in correctly. */ |
Chris Lattner | 9d18647 | 2010-04-29 23:27:32 +0000 | [diff] [blame] | 132 | static inline LLVMBool LLVMInitializeNativeTarget(void) { |
Bob Wilson | 5a495fe | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 133 | /* If we have a native target, initialize it to ensure it is linked in. */ |
Eric Christopher | e7a9db1 | 2010-08-30 18:34:48 +0000 | [diff] [blame] | 134 | #ifdef LLVM_NATIVE_TARGET |
| 135 | LLVM_NATIVE_TARGETINFO(); |
| 136 | LLVM_NATIVE_TARGET(); |
Evan Cheng | 8c886a4 | 2011-07-22 21:58:54 +0000 | [diff] [blame] | 137 | LLVM_NATIVE_TARGETMC(); |
Bob Wilson | 5a495fe | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 138 | return 0; |
Bob Wilson | 5a495fe | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 139 | #else |
| 140 | return 1; |
| 141 | #endif |
NAKAMURA Takumi | a3a8135 | 2013-10-23 17:56:29 +0000 | [diff] [blame] | 142 | } |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 143 | |
Peter Zotov | 04f5981 | 2013-11-06 09:21:35 +0000 | [diff] [blame] | 144 | /** LLVMInitializeNativeTargetAsmParser - The main program should call this |
| 145 | function to initialize the parser for the native target corresponding to the |
| 146 | host. */ |
Peter Zotov | 6b5e8b9 | 2013-11-06 09:45:53 +0000 | [diff] [blame] | 147 | static inline LLVMBool LLVMInitializeNativeAsmParser(void) { |
| 148 | #ifdef LLVM_NATIVE_ASMPARSER |
Peter Zotov | 04f5981 | 2013-11-06 09:21:35 +0000 | [diff] [blame] | 149 | LLVM_NATIVE_ASMPARSER(); |
| 150 | return 0; |
| 151 | #else |
| 152 | return 1; |
| 153 | #endif |
| 154 | } |
| 155 | |
| 156 | /** LLVMInitializeNativeTargetAsmPrinter - The main program should call this |
| 157 | function to initialize the printer for the native target corresponding to |
| 158 | the host. */ |
Peter Zotov | 6b5e8b9 | 2013-11-06 09:45:53 +0000 | [diff] [blame] | 159 | static inline LLVMBool LLVMInitializeNativeAsmPrinter(void) { |
| 160 | #ifdef LLVM_NATIVE_ASMPRINTER |
Peter Zotov | 04f5981 | 2013-11-06 09:21:35 +0000 | [diff] [blame] | 161 | LLVM_NATIVE_ASMPRINTER(); |
| 162 | return 0; |
| 163 | #else |
| 164 | return 1; |
| 165 | #endif |
| 166 | } |
| 167 | |
| 168 | /** LLVMInitializeNativeTargetDisassembler - The main program should call this |
| 169 | function to initialize the disassembler for the native target corresponding |
| 170 | to the host. */ |
Peter Zotov | 6b5e8b9 | 2013-11-06 09:45:53 +0000 | [diff] [blame] | 171 | static inline LLVMBool LLVMInitializeNativeDisassembler(void) { |
| 172 | #ifdef LLVM_NATIVE_DISASSEMBLER |
Peter Zotov | 04f5981 | 2013-11-06 09:21:35 +0000 | [diff] [blame] | 173 | LLVM_NATIVE_DISASSEMBLER(); |
| 174 | return 0; |
| 175 | #else |
| 176 | return 1; |
| 177 | #endif |
| 178 | } |
| 179 | |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 180 | /*===-- Target Data -------------------------------------------------------===*/ |
| 181 | |
Amaury Sechet | 5590967 | 2016-02-16 05:11:24 +0000 | [diff] [blame] | 182 | /** |
| 183 | * Obtain the data layout for a module. |
| 184 | * |
| 185 | * @see Module::getDataLayout() |
| 186 | */ |
| 187 | LLVMTargetDataRef LLVMGetModuleDataLayout(LLVMModuleRef M); |
| 188 | |
| 189 | /** |
| 190 | * Set the data layout for a module. |
| 191 | * |
| 192 | * @see Module::setDataLayout() |
| 193 | */ |
| 194 | void LLVMSetModuleDataLayout(LLVMModuleRef M, LLVMTargetDataRef DL); |
| 195 | |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 196 | /** Creates target data from a target layout string. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 197 | See the constructor llvm::DataLayout::DataLayout. */ |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 198 | LLVMTargetDataRef LLVMCreateTargetData(const char *StringRep); |
| 199 | |
Amaury Sechet | 22d2878 | 2016-02-17 22:41:09 +0000 | [diff] [blame] | 200 | /** Deallocates a TargetData. |
| 201 | See the destructor llvm::DataLayout::~DataLayout. */ |
| 202 | void LLVMDisposeTargetData(LLVMTargetDataRef TD); |
| 203 | |
Rafael Espindola | e96fd5a | 2011-07-25 21:20:54 +0000 | [diff] [blame] | 204 | /** Adds target library information to a pass manager. This does not take |
| 205 | ownership of the target library info. |
| 206 | See the method llvm::PassManagerBase::add. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 207 | void LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef TLI, |
| 208 | LLVMPassManagerRef PM); |
Rafael Espindola | e96fd5a | 2011-07-25 21:20:54 +0000 | [diff] [blame] | 209 | |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 210 | /** Converts target data to a target layout string. The string must be disposed |
| 211 | with LLVMDisposeMessage. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 212 | See the constructor llvm::DataLayout::DataLayout. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 213 | char *LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 214 | |
| 215 | /** Returns the byte order of a target, either LLVMBigEndian or |
| 216 | LLVMLittleEndian. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 217 | See the method llvm::DataLayout::isLittleEndian. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 218 | enum LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef TD); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 219 | |
| 220 | /** Returns the pointer size in bytes for a target. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 221 | See the method llvm::DataLayout::getPointerSize. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 222 | unsigned LLVMPointerSize(LLVMTargetDataRef TD); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 223 | |
Micah Villmow | 4bb926d | 2012-10-15 16:24:29 +0000 | [diff] [blame] | 224 | /** Returns the pointer size in bytes for a target for a specified |
| 225 | address space. |
| 226 | See the method llvm::DataLayout::getPointerSize. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 227 | unsigned LLVMPointerSizeForAS(LLVMTargetDataRef TD, unsigned AS); |
Micah Villmow | 4bb926d | 2012-10-15 16:24:29 +0000 | [diff] [blame] | 228 | |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 229 | /** Returns the integer type that is the same size as a pointer on a target. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 230 | See the method llvm::DataLayout::getIntPtrType. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 231 | LLVMTypeRef LLVMIntPtrType(LLVMTargetDataRef TD); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 232 | |
Micah Villmow | 4bb926d | 2012-10-15 16:24:29 +0000 | [diff] [blame] | 233 | /** Returns the integer type that is the same size as a pointer on a target. |
| 234 | This version allows the address space to be specified. |
| 235 | See the method llvm::DataLayout::getIntPtrType. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 236 | LLVMTypeRef LLVMIntPtrTypeForAS(LLVMTargetDataRef TD, unsigned AS); |
Micah Villmow | 4bb926d | 2012-10-15 16:24:29 +0000 | [diff] [blame] | 237 | |
Anders Waldenborg | 959f040 | 2013-10-17 18:51:01 +0000 | [diff] [blame] | 238 | /** Returns the integer type that is the same size as a pointer on a target. |
| 239 | See the method llvm::DataLayout::getIntPtrType. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 240 | LLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef C, LLVMTargetDataRef TD); |
Anders Waldenborg | 959f040 | 2013-10-17 18:51:01 +0000 | [diff] [blame] | 241 | |
| 242 | /** Returns the integer type that is the same size as a pointer on a target. |
| 243 | This version allows the address space to be specified. |
| 244 | See the method llvm::DataLayout::getIntPtrType. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 245 | LLVMTypeRef LLVMIntPtrTypeForASInContext(LLVMContextRef C, LLVMTargetDataRef TD, |
| 246 | unsigned AS); |
Anders Waldenborg | 959f040 | 2013-10-17 18:51:01 +0000 | [diff] [blame] | 247 | |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 248 | /** Computes the size of a type in bytes for a target. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 249 | See the method llvm::DataLayout::getTypeSizeInBits. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 250 | unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef TD, LLVMTypeRef Ty); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 251 | |
| 252 | /** Computes the storage size of a type in bytes for a target. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 253 | See the method llvm::DataLayout::getTypeStoreSize. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 254 | unsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 255 | |
| 256 | /** Computes the ABI size of a type in bytes for a target. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 257 | See the method llvm::DataLayout::getTypeAllocSize. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 258 | unsigned long long LLVMABISizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 259 | |
| 260 | /** Computes the ABI alignment of a type in bytes for a target. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 261 | See the method llvm::DataLayout::getTypeABISize. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 262 | unsigned LLVMABIAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 263 | |
| 264 | /** Computes the call frame alignment of a type in bytes for a target. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 265 | See the method llvm::DataLayout::getTypeABISize. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 266 | unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 267 | |
| 268 | /** Computes the preferred alignment of a type in bytes for a target. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 269 | See the method llvm::DataLayout::getTypeABISize. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 270 | unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 271 | |
| 272 | /** Computes the preferred alignment of a global variable in bytes for a target. |
Micah Villmow | cdfe20b | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 273 | See the method llvm::DataLayout::getPreferredAlignment. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 274 | unsigned LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef TD, |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 275 | LLVMValueRef GlobalVar); |
| 276 | |
| 277 | /** Computes the structure element that contains the byte offset for a target. |
| 278 | See the method llvm::StructLayout::getElementContainingOffset. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 279 | unsigned LLVMElementAtOffset(LLVMTargetDataRef TD, LLVMTypeRef StructTy, |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 280 | unsigned long long Offset); |
| 281 | |
| 282 | /** Computes the byte offset of the indexed struct element for a target. |
| 283 | See the method llvm::StructLayout::getElementContainingOffset. */ |
Peter Zotov | f7e64fe | 2013-11-06 11:52:40 +0000 | [diff] [blame] | 284 | unsigned long long LLVMOffsetOfElement(LLVMTargetDataRef TD, |
| 285 | LLVMTypeRef StructTy, unsigned Element); |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 286 | |
Gregory Szorc | 34c863a | 2012-03-21 03:54:29 +0000 | [diff] [blame] | 287 | /** |
| 288 | * @} |
| 289 | */ |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 290 | |
| 291 | #ifdef __cplusplus |
| 292 | } |
Evan Cheng | 2e254d0 | 2013-04-04 17:40:53 +0000 | [diff] [blame] | 293 | #endif /* defined(__cplusplus) */ |
Gordon Henriksen | ab4b7d3 | 2008-03-16 20:08:03 +0000 | [diff] [blame] | 294 | |
| 295 | #endif |