1eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/*===-- llvm-c/Target.h - Target Lib C Iface --------------------*- C++ -*-===*/ 2eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* */ 3eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* The LLVM Compiler Infrastructure */ 4eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* */ 5eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* This file is distributed under the University of Illinois Open Source */ 6eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* License. See LICENSE.TXT for details. */ 7eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* */ 8eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/*===----------------------------------------------------------------------===*/ 9eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* */ 10eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* This header declares the C interface to libLLVMTarget.a, which */ 11eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* implements target information. */ 12eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* */ 13eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* Many exotic languages can interoperate with C code but have a harder time */ 14eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* with C++ due to name mangling. So in addition to C, this interface enables */ 15eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* tools written in such languages. */ 16eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/* */ 17eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher/*===----------------------------------------------------------------------===*/ 183e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 193e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen#ifndef LLVM_C_TARGET_H 203e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen#define LLVM_C_TARGET_H 213e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 22cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar#include "llvm-c/Types.h" 23eec5008e77ebfff7fd0723f4a21b88fde5d04b87Eric Christopher#include "llvm/Config/llvm-config.h" 243e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 25473436709959f09ed3ed415de0f17820d9188d09NAKAMURA Takumi#if defined(_MSC_VER) && !defined(inline) 26473436709959f09ed3ed415de0f17820d9188d09NAKAMURA Takumi#define inline __inline 27473436709959f09ed3ed415de0f17820d9188d09NAKAMURA Takumi#endif 28473436709959f09ed3ed415de0f17820d9188d09NAKAMURA Takumi 293e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen#ifdef __cplusplus 303e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksenextern "C" { 313e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen#endif 323e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 336244b518880842f2c15200ee041e06799e4cc779Gregory Szorc/** 346244b518880842f2c15200ee041e06799e4cc779Gregory Szorc * @defgroup LLVMCTarget Target information 356244b518880842f2c15200ee041e06799e4cc779Gregory Szorc * @ingroup LLVMC 366244b518880842f2c15200ee041e06799e4cc779Gregory Szorc * 376244b518880842f2c15200ee041e06799e4cc779Gregory Szorc * @{ 386244b518880842f2c15200ee041e06799e4cc779Gregory Szorc */ 396244b518880842f2c15200ee041e06799e4cc779Gregory Szorc 40d686c8e73f74e37ab5f647b65a12051ee6cbad16Chris Lattnerenum LLVMByteOrdering { LLVMBigEndian, LLVMLittleEndian }; 413e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 423e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksentypedef struct LLVMOpaqueTargetData *LLVMTargetDataRef; 435160d381669f1367290b802c90074cdf896d5c49Rafael Espindolatypedef struct LLVMOpaqueTargetLibraryInfotData *LLVMTargetLibraryInfoRef; 443e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 45a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson/* Declare all of the target-initialization functions that are available. */ 46ca3ca138d88139e24a8e60fef982436575a19f38Eric Christopher#define LLVM_TARGET(TargetName) \ 47ca3ca138d88139e24a8e60fef982436575a19f38Eric Christopher void LLVMInitialize##TargetName##TargetInfo(void); 48baf3eddc7804c7b7e023a2407e5c93735fb08affDaniel Dunbar#include "llvm/Config/Targets.def" 49b6219ba3d609d7f65285a41bad86626f7436f00fChris Lattner#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ 50e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi 51ff33d833225d392600626f8f7bdfdf5a29482e75Chris Lattner#define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target(void); 52a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson#include "llvm/Config/Targets.def" 53b6219ba3d609d7f65285a41bad86626f7436f00fChris Lattner#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ 54a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson 551abf2cb59b8d63415780a03329307c0997b2670cEvan Cheng#define LLVM_TARGET(TargetName) \ 56e78085a3c03de648a481e9751c3094c517bd7123Evan Cheng void LLVMInitialize##TargetName##TargetMC(void); 57439661395fd2a2a832dba01c65bc88718528313cEvan Cheng#include "llvm/Config/Targets.def" 58439661395fd2a2a832dba01c65bc88718528313cEvan Cheng#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ 59e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi 6072736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar/* Declare all of the available assembly printer initialization functions. */ 6172736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar#define LLVM_ASM_PRINTER(TargetName) \ 628ed9951c3a2c19d8374946c83f51c1b018b8897fAnders Waldenborg void LLVMInitialize##TargetName##AsmPrinter(void); 6372736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar#include "llvm/Config/AsmPrinters.def" 6429a776b8242d63cafc3d26e8183fee13273fca2eBill Wendling#undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */ 6572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar 6672736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar/* Declare all of the available assembly parser initialization functions. */ 6772736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar#define LLVM_ASM_PARSER(TargetName) \ 688ed9951c3a2c19d8374946c83f51c1b018b8897fAnders Waldenborg void LLVMInitialize##TargetName##AsmParser(void); 6972736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar#include "llvm/Config/AsmParsers.def" 7029a776b8242d63cafc3d26e8183fee13273fca2eBill Wendling#undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */ 7172736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar 7272736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar/* Declare all of the available disassembler initialization functions. */ 7372736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar#define LLVM_DISASSEMBLER(TargetName) \ 748ed9951c3a2c19d8374946c83f51c1b018b8897fAnders Waldenborg void LLVMInitialize##TargetName##Disassembler(void); 7572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar#include "llvm/Config/Disassemblers.def" 7629a776b8242d63cafc3d26e8183fee13273fca2eBill Wendling#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */ 77e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi 78baf3eddc7804c7b7e023a2407e5c93735fb08affDaniel Dunbar/** LLVMInitializeAllTargetInfos - The main program should call this function if 79baf3eddc7804c7b7e023a2407e5c93735fb08affDaniel Dunbar it wants access to all available targets that LLVM is configured to 80baf3eddc7804c7b7e023a2407e5c93735fb08affDaniel Dunbar support. */ 81bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstatic inline void LLVMInitializeAllTargetInfos(void) { 82bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo(); 83bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#include "llvm/Config/Targets.def" 84bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ 85bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg} 86baf3eddc7804c7b7e023a2407e5c93735fb08affDaniel Dunbar 87a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson/** LLVMInitializeAllTargets - The main program should call this function if it 88a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson wants to link in all available targets that LLVM is configured to 89a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson support. */ 90bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstatic inline void LLVMInitializeAllTargets(void) { 91bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target(); 92bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#include "llvm/Config/Targets.def" 93bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ 94bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg} 9572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar 9672736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar/** LLVMInitializeAllTargetMCs - The main program should call this function if 9772736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar it wants access to all available target MC that LLVM is configured to 9872736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar support. */ 99bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstatic inline void LLVMInitializeAllTargetMCs(void) { 100bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetMC(); 101bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#include "llvm/Config/Targets.def" 102bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ 103bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg} 104e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi 10572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar/** LLVMInitializeAllAsmPrinters - The main program should call this function if 10672736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar it wants all asm printers that LLVM is configured to support, to make them 10772736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar available via the TargetRegistry. */ 108bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstatic inline void LLVMInitializeAllAsmPrinters(void) { 109bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#define LLVM_ASM_PRINTER(TargetName) LLVMInitialize##TargetName##AsmPrinter(); 110bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#include "llvm/Config/AsmPrinters.def" 111bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */ 112bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg} 113e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi 11472736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar/** LLVMInitializeAllAsmParsers - The main program should call this function if 11572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar it wants all asm parsers that LLVM is configured to support, to make them 11672736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar available via the TargetRegistry. */ 117bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstatic inline void LLVMInitializeAllAsmParsers(void) { 118bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#define LLVM_ASM_PARSER(TargetName) LLVMInitialize##TargetName##AsmParser(); 119bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#include "llvm/Config/AsmParsers.def" 120bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */ 121bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg} 122e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi 12372736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar/** LLVMInitializeAllDisassemblers - The main program should call this function 12472736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar if it wants all disassemblers that LLVM is configured to support, to make 12572736d1aa3a731cdbdef2ad7e3a861c5afd7fce7Daniel Dunbar them available via the TargetRegistry. */ 126bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborgstatic inline void LLVMInitializeAllDisassemblers(void) { 127bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#define LLVM_DISASSEMBLER(TargetName) \ 128bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg LLVMInitialize##TargetName##Disassembler(); 129bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#include "llvm/Config/Disassemblers.def" 130bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */ 131bfcd45cfe114311b32b171c529fd387dd8eac55fAnders Waldenborg} 132e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi 133a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson/** LLVMInitializeNativeTarget - The main program should call this function to 134e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi initialize the native target corresponding to the host. This is useful 135a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson for JIT applications to ensure that the target gets linked in correctly. */ 136c799c55a339b69ee6aeb03b29f4ea7b2dcea0c7bChris Lattnerstatic inline LLVMBool LLVMInitializeNativeTarget(void) { 137a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson /* If we have a native target, initialize it to ensure it is linked in. */ 138753f3265dafdcfeec07b561ca278524c35477583Eric Christopher#ifdef LLVM_NATIVE_TARGET 139753f3265dafdcfeec07b561ca278524c35477583Eric Christopher LLVM_NATIVE_TARGETINFO(); 140753f3265dafdcfeec07b561ca278524c35477583Eric Christopher LLVM_NATIVE_TARGET(); 141e78085a3c03de648a481e9751c3094c517bd7123Evan Cheng LLVM_NATIVE_TARGETMC(); 142a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson return 0; 143a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson#else 144a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson return 1; 145a96751fc8ff1cc9a225ffbba73de53e2b9e1ae35Bob Wilson#endif 146e21c3137e1dfcd9644d3870a0a4528374375271fNAKAMURA Takumi} 1473e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 14843b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov/** LLVMInitializeNativeTargetAsmParser - The main program should call this 14943b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov function to initialize the parser for the native target corresponding to the 15043b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov host. */ 151e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotovstatic inline LLVMBool LLVMInitializeNativeAsmParser(void) { 152e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotov#ifdef LLVM_NATIVE_ASMPARSER 15343b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov LLVM_NATIVE_ASMPARSER(); 15443b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov return 0; 15543b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov#else 15643b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov return 1; 15743b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov#endif 15843b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov} 15943b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 16043b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov/** LLVMInitializeNativeTargetAsmPrinter - The main program should call this 16143b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov function to initialize the printer for the native target corresponding to 16243b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov the host. */ 163e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotovstatic inline LLVMBool LLVMInitializeNativeAsmPrinter(void) { 164e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotov#ifdef LLVM_NATIVE_ASMPRINTER 16543b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov LLVM_NATIVE_ASMPRINTER(); 16643b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov return 0; 16743b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov#else 16843b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov return 1; 16943b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov#endif 17043b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov} 17143b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 17243b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov/** LLVMInitializeNativeTargetDisassembler - The main program should call this 17343b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov function to initialize the disassembler for the native target corresponding 17443b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov to the host. */ 175e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotovstatic inline LLVMBool LLVMInitializeNativeDisassembler(void) { 176e669e09d7d4245a88b10a772be3ba97aa5e14923Peter Zotov#ifdef LLVM_NATIVE_DISASSEMBLER 17743b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov LLVM_NATIVE_DISASSEMBLER(); 17843b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov return 0; 17943b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov#else 18043b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov return 1; 18143b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov#endif 18243b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov} 18343b255884a9ea4040c2c62dcbb957159cb7f31daPeter Zotov 1843e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/*===-- Target Data -------------------------------------------------------===*/ 1853e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 1863e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Creates target data from a target layout string. 1873574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the constructor llvm::DataLayout::DataLayout. */ 1883e0c83559397c87e06ef29c41385e7adc34573c2Gordon HenriksenLLVMTargetDataRef LLVMCreateTargetData(const char *StringRep); 1893e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 1903e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Adds target data information to a pass manager. This does not take ownership 1913e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen of the target data. 1923e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen See the method llvm::PassManagerBase::add. */ 193573a231a3102657faf846e588517d01801154100Peter Zotovvoid LLVMAddTargetData(LLVMTargetDataRef TD, LLVMPassManagerRef PM); 1943e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 1955160d381669f1367290b802c90074cdf896d5c49Rafael Espindola/** Adds target library information to a pass manager. This does not take 1965160d381669f1367290b802c90074cdf896d5c49Rafael Espindola ownership of the target library info. 1975160d381669f1367290b802c90074cdf896d5c49Rafael Espindola See the method llvm::PassManagerBase::add. */ 198573a231a3102657faf846e588517d01801154100Peter Zotovvoid LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef TLI, 199573a231a3102657faf846e588517d01801154100Peter Zotov LLVMPassManagerRef PM); 2005160d381669f1367290b802c90074cdf896d5c49Rafael Espindola 2013e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Converts target data to a target layout string. The string must be disposed 2023e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen with LLVMDisposeMessage. 2033574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the constructor llvm::DataLayout::DataLayout. */ 204573a231a3102657faf846e588517d01801154100Peter Zotovchar *LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD); 2053e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2063e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Returns the byte order of a target, either LLVMBigEndian or 2073e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen LLVMLittleEndian. 2083574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the method llvm::DataLayout::isLittleEndian. */ 209573a231a3102657faf846e588517d01801154100Peter Zotovenum LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef TD); 2103e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2113e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Returns the pointer size in bytes for a target. 2123574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the method llvm::DataLayout::getPointerSize. */ 213573a231a3102657faf846e588517d01801154100Peter Zotovunsigned LLVMPointerSize(LLVMTargetDataRef TD); 2143e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2152c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow/** Returns the pointer size in bytes for a target for a specified 2162c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow address space. 2172c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow See the method llvm::DataLayout::getPointerSize. */ 218573a231a3102657faf846e588517d01801154100Peter Zotovunsigned LLVMPointerSizeForAS(LLVMTargetDataRef TD, unsigned AS); 2192c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow 2203e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Returns the integer type that is the same size as a pointer on a target. 2213574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the method llvm::DataLayout::getIntPtrType. */ 222573a231a3102657faf846e588517d01801154100Peter ZotovLLVMTypeRef LLVMIntPtrType(LLVMTargetDataRef TD); 2233e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2242c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow/** Returns the integer type that is the same size as a pointer on a target. 2252c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow This version allows the address space to be specified. 2262c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow See the method llvm::DataLayout::getIntPtrType. */ 227573a231a3102657faf846e588517d01801154100Peter ZotovLLVMTypeRef LLVMIntPtrTypeForAS(LLVMTargetDataRef TD, unsigned AS); 2282c39b15073db81d93bb629303915b7d7e5d088dcMicah Villmow 229f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg/** Returns the integer type that is the same size as a pointer on a target. 230f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg See the method llvm::DataLayout::getIntPtrType. */ 231573a231a3102657faf846e588517d01801154100Peter ZotovLLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef C, LLVMTargetDataRef TD); 232f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg 233f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg/** Returns the integer type that is the same size as a pointer on a target. 234f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg This version allows the address space to be specified. 235f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg See the method llvm::DataLayout::getIntPtrType. */ 236573a231a3102657faf846e588517d01801154100Peter ZotovLLVMTypeRef LLVMIntPtrTypeForASInContext(LLVMContextRef C, LLVMTargetDataRef TD, 237573a231a3102657faf846e588517d01801154100Peter Zotov unsigned AS); 238f4094e5ed7387b29eda8d9a7865f6b5dfd47ce82Anders Waldenborg 2393e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Computes the size of a type in bytes for a target. 2403574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the method llvm::DataLayout::getTypeSizeInBits. */ 241573a231a3102657faf846e588517d01801154100Peter Zotovunsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef TD, LLVMTypeRef Ty); 2423e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2433e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Computes the storage size of a type in bytes for a target. 2443574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the method llvm::DataLayout::getTypeStoreSize. */ 245573a231a3102657faf846e588517d01801154100Peter Zotovunsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); 2463e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2473e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Computes the ABI size of a type in bytes for a target. 2483574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the method llvm::DataLayout::getTypeAllocSize. */ 249573a231a3102657faf846e588517d01801154100Peter Zotovunsigned long long LLVMABISizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); 2503e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2513e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Computes the ABI alignment of a type in bytes for a target. 2523574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the method llvm::DataLayout::getTypeABISize. */ 253573a231a3102657faf846e588517d01801154100Peter Zotovunsigned LLVMABIAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); 2543e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2553e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Computes the call frame alignment of a type in bytes for a target. 2563574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the method llvm::DataLayout::getTypeABISize. */ 257573a231a3102657faf846e588517d01801154100Peter Zotovunsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); 2583e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2593e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Computes the preferred alignment of a type in bytes for a target. 2603574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the method llvm::DataLayout::getTypeABISize. */ 261573a231a3102657faf846e588517d01801154100Peter Zotovunsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty); 2623e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2633e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Computes the preferred alignment of a global variable in bytes for a target. 2643574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the method llvm::DataLayout::getPreferredAlignment. */ 265573a231a3102657faf846e588517d01801154100Peter Zotovunsigned LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef TD, 2663e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen LLVMValueRef GlobalVar); 2673e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2683e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Computes the structure element that contains the byte offset for a target. 2693e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen See the method llvm::StructLayout::getElementContainingOffset. */ 270573a231a3102657faf846e588517d01801154100Peter Zotovunsigned LLVMElementAtOffset(LLVMTargetDataRef TD, LLVMTypeRef StructTy, 2713e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen unsigned long long Offset); 2723e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2733e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Computes the byte offset of the indexed struct element for a target. 2743e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen See the method llvm::StructLayout::getElementContainingOffset. */ 275573a231a3102657faf846e588517d01801154100Peter Zotovunsigned long long LLVMOffsetOfElement(LLVMTargetDataRef TD, 276573a231a3102657faf846e588517d01801154100Peter Zotov LLVMTypeRef StructTy, unsigned Element); 2773e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2783e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen/** Deallocates a TargetData. 2793574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow See the destructor llvm::DataLayout::~DataLayout. */ 280573a231a3102657faf846e588517d01801154100Peter Zotovvoid LLVMDisposeTargetData(LLVMTargetDataRef TD); 2813e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2826244b518880842f2c15200ee041e06799e4cc779Gregory Szorc/** 2836244b518880842f2c15200ee041e06799e4cc779Gregory Szorc * @} 2846244b518880842f2c15200ee041e06799e4cc779Gregory Szorc */ 2853e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2863e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen#ifdef __cplusplus 2873e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen} 2889313da5a90838c7242101dae250e86dcfc708e6aEvan Cheng#endif /* defined(__cplusplus) */ 2893e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen 2903e0c83559397c87e06ef29c41385e7adc34573c2Gordon Henriksen#endif 291