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