diff options
Diffstat (limited to 'contrib/llvm/include/llvm-c')
-rw-r--r-- | contrib/llvm/include/llvm-c/Core.h | 216 | ||||
-rw-r--r-- | contrib/llvm/include/llvm-c/ExecutionEngine.h | 59 | ||||
-rw-r--r-- | contrib/llvm/include/llvm-c/Object.h | 46 | ||||
-rw-r--r-- | contrib/llvm/include/llvm-c/Target.h | 23 | ||||
-rw-r--r-- | contrib/llvm/include/llvm-c/TargetMachine.h | 27 | ||||
-rw-r--r-- | contrib/llvm/include/llvm-c/Transforms/PassManagerBuilder.h | 10 | ||||
-rw-r--r-- | contrib/llvm/include/llvm-c/Transforms/Vectorize.h | 3 |
7 files changed, 136 insertions, 248 deletions
diff --git a/contrib/llvm/include/llvm-c/Core.h b/contrib/llvm/include/llvm-c/Core.h index e85fb97..6b62f33 100644 --- a/contrib/llvm/include/llvm-c/Core.h +++ b/contrib/llvm/include/llvm-c/Core.h @@ -18,13 +18,6 @@ #include "llvm/Support/DataTypes.h" #ifdef __cplusplus - -/* Need these includes to support the LLVM 'cast' template for the C++ 'wrap' - and 'unwrap' conversion functions. */ -#include "llvm/IR/IRBuilder.h" -#include "llvm/IR/Module.h" -#include "llvm/PassRegistry.h" - extern "C" { #endif @@ -60,11 +53,6 @@ extern "C" { * with C++ due to name mangling. So in addition to C, this interface enables * tools written in such languages. * - * When included into a C++ source file, also declares 'wrap' and 'unwrap' - * helpers to perform opaque reference<-->pointer conversions. These helpers - * are shorter and more tightly typed than writing the casts by hand when - * authoring bindings. In assert builds, they will do runtime type checking. - * * @{ */ @@ -352,6 +340,63 @@ typedef enum { LLVMLandingPadFilter /**< A filter clause */ } LLVMLandingPadClauseTy; +typedef enum { + LLVMNotThreadLocal = 0, + LLVMGeneralDynamicTLSModel, + LLVMLocalDynamicTLSModel, + LLVMInitialExecTLSModel, + LLVMLocalExecTLSModel +} LLVMThreadLocalMode; + +typedef enum { + LLVMAtomicOrderingNotAtomic = 0, /**< A load or store which is not atomic */ + LLVMAtomicOrderingUnordered = 1, /**< Lowest level of atomicity, guarantees + somewhat sane results, lock free. */ + LLVMAtomicOrderingMonotonic = 2, /**< guarantees that if you take all the + operations affecting a specific address, + a consistent ordering exists */ + LLVMAtomicOrderingAcquire = 4, /**< Acquire provides a barrier of the sort + necessary to acquire a lock to access other + memory with normal loads and stores. */ + LLVMAtomicOrderingRelease = 5, /**< Release is similar to Acquire, but with + a barrier of the sort necessary to release + a lock. */ + LLVMAtomicOrderingAcquireRelease = 6, /**< provides both an Acquire and a + Release barrier (for fences and + operations which both read and write + memory). */ + LLVMAtomicOrderingSequentiallyConsistent = 7 /**< provides Acquire semantics + for loads and Release + semantics for stores. + Additionally, it guarantees + that a total ordering exists + between all + SequentiallyConsistent + operations. */ +} LLVMAtomicOrdering; + +typedef enum { + LLVMAtomicRMWBinOpXchg, /**< Set the new value and return the one old */ + LLVMAtomicRMWBinOpAdd, /**< Add a value and return the old one */ + LLVMAtomicRMWBinOpSub, /**< Subtract a value and return the old one */ + LLVMAtomicRMWBinOpAnd, /**< And a value and return the old one */ + LLVMAtomicRMWBinOpNand, /**< Not-And a value and return the old one */ + LLVMAtomicRMWBinOpOr, /**< OR a value and return the old one */ + LLVMAtomicRMWBinOpXor, /**< Xor a value and return the old one */ + LLVMAtomicRMWBinOpMax, /**< Sets the value if it's greater than the + original using a signed comparison and return + the old one */ + LLVMAtomicRMWBinOpMin, /**< Sets the value if it's Smaller than the + original using a signed comparison and return + the old one */ + LLVMAtomicRMWBinOpUMax, /**< Sets the value if it's greater than the + original using an unsigned comparison and return + the old one */ + LLVMAtomicRMWBinOpUMin /**< Sets the value if it's greater than the + original using an unsigned comparison and return + the old one */ +} LLVMAtomicRMWBinOp; + /** * @} */ @@ -1057,24 +1102,24 @@ LLVMTypeRef LLVMX86MMXType(void); macro(SwitchInst) \ macro(UnreachableInst) \ macro(ResumeInst) \ - macro(UnaryInstruction) \ - macro(AllocaInst) \ - macro(CastInst) \ - macro(BitCastInst) \ - macro(FPExtInst) \ - macro(FPToSIInst) \ - macro(FPToUIInst) \ - macro(FPTruncInst) \ - macro(IntToPtrInst) \ - macro(PtrToIntInst) \ - macro(SExtInst) \ - macro(SIToFPInst) \ - macro(TruncInst) \ - macro(UIToFPInst) \ - macro(ZExtInst) \ - macro(ExtractValueInst) \ - macro(LoadInst) \ - macro(VAArgInst) + macro(UnaryInstruction) \ + macro(AllocaInst) \ + macro(CastInst) \ + macro(BitCastInst) \ + macro(FPExtInst) \ + macro(FPToSIInst) \ + macro(FPToUIInst) \ + macro(FPTruncInst) \ + macro(IntToPtrInst) \ + macro(PtrToIntInst) \ + macro(SExtInst) \ + macro(SIToFPInst) \ + macro(TruncInst) \ + macro(UIToFPInst) \ + macro(ZExtInst) \ + macro(ExtractValueInst) \ + macro(LoadInst) \ + macro(VAArgInst) /** * @defgroup LLVMCCoreValueGeneral General APIs @@ -1606,6 +1651,10 @@ LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar); void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal); LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar); void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant); +LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar); +void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode); +LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar); +void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit); /** * @} @@ -1694,6 +1743,13 @@ void LLVMSetGC(LLVMValueRef Fn, const char *Name); void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA); /** + * Add a target-dependent attribute to a fuction + * @see llvm::AttrBuilder::addAttribute() + */ +void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, + const char *V); + +/** * Obtain an attribute from a function. * * @see llvm::Function::getAttributes() @@ -2515,6 +2571,10 @@ LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef, LLVMValueRef Val, const char *Name); LLVMValueRef LLVMBuildPtrDiff(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name); +LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B,LLVMAtomicRMWBinOp op, + LLVMValueRef PTR, LLVMValueRef Val, + LLVMAtomicOrdering ordering, + LLVMBool singleThread); /** * @} @@ -2560,6 +2620,8 @@ LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName); +const char *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf); +size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf); void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf); /** @@ -2669,100 +2731,6 @@ LLVMBool LLVMIsMultithreaded(); #ifdef __cplusplus } - -namespace llvm { - class MemoryBuffer; - class PassManagerBase; - - #define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \ - inline ty *unwrap(ref P) { \ - return reinterpret_cast<ty*>(P); \ - } \ - \ - inline ref wrap(const ty *P) { \ - return reinterpret_cast<ref>(const_cast<ty*>(P)); \ - } - - #define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref) \ - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \ - \ - template<typename T> \ - inline T *unwrap(ref P) { \ - return cast<T>(unwrap(P)); \ - } - - #define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref) \ - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \ - \ - template<typename T> \ - inline T *unwrap(ref P) { \ - T *Q = (T*)unwrap(P); \ - assert(Q && "Invalid cast!"); \ - return Q; \ - } - - DEFINE_ISA_CONVERSION_FUNCTIONS (Type, LLVMTypeRef ) - DEFINE_ISA_CONVERSION_FUNCTIONS (Value, LLVMValueRef ) - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module, LLVMModuleRef ) - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef ) - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder<>, LLVMBuilderRef ) - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MemoryBuffer, LLVMMemoryBufferRef ) - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMContext, LLVMContextRef ) - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Use, LLVMUseRef ) - DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassManagerBase, LLVMPassManagerRef ) - DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassRegistry, LLVMPassRegistryRef ) - /* LLVMModuleProviderRef exists for historical reasons, but now just holds a - * Module. - */ - inline Module *unwrap(LLVMModuleProviderRef MP) { - return reinterpret_cast<Module*>(MP); - } - - #undef DEFINE_STDCXX_CONVERSION_FUNCTIONS - #undef DEFINE_ISA_CONVERSION_FUNCTIONS - #undef DEFINE_SIMPLE_CONVERSION_FUNCTIONS - - /* Specialized opaque context conversions. - */ - inline LLVMContext **unwrap(LLVMContextRef* Tys) { - return reinterpret_cast<LLVMContext**>(Tys); - } - - inline LLVMContextRef *wrap(const LLVMContext **Tys) { - return reinterpret_cast<LLVMContextRef*>(const_cast<LLVMContext**>(Tys)); - } - - /* Specialized opaque type conversions. - */ - inline Type **unwrap(LLVMTypeRef* Tys) { - return reinterpret_cast<Type**>(Tys); - } - - inline LLVMTypeRef *wrap(Type **Tys) { - return reinterpret_cast<LLVMTypeRef*>(const_cast<Type**>(Tys)); - } - - /* Specialized opaque value conversions. - */ - inline Value **unwrap(LLVMValueRef *Vals) { - return reinterpret_cast<Value**>(Vals); - } - - template<typename T> - inline T **unwrap(LLVMValueRef *Vals, unsigned Length) { - #ifdef DEBUG - for (LLVMValueRef *I = Vals, *E = Vals + Length; I != E; ++I) - cast<T>(*I); - #endif - (void)Length; - return reinterpret_cast<T**>(Vals); - } - - inline LLVMValueRef *wrap(const Value **Vals) { - return reinterpret_cast<LLVMValueRef*>(const_cast<Value**>(Vals)); - } -} - #endif /* !defined(__cplusplus) */ #endif /* !defined(LLVM_C_CORE_H) */ diff --git a/contrib/llvm/include/llvm-c/ExecutionEngine.h b/contrib/llvm/include/llvm-c/ExecutionEngine.h index cb77bb2..8fae77d 100644 --- a/contrib/llvm/include/llvm-c/ExecutionEngine.h +++ b/contrib/llvm/include/llvm-c/ExecutionEngine.h @@ -21,6 +21,7 @@ #include "llvm-c/Core.h" #include "llvm-c/Target.h" +#include "llvm-c/TargetMachine.h" #ifdef __cplusplus extern "C" { @@ -34,11 +35,19 @@ extern "C" { */ void LLVMLinkInJIT(void); +void LLVMLinkInMCJIT(void); void LLVMLinkInInterpreter(void); typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef; typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef; +struct LLVMMCJITCompilerOptions { + unsigned OptLevel; + LLVMCodeModel CodeModel; + LLVMBool NoFramePointerElim; + LLVMBool EnableFastISel; +}; + /*===-- Operations on generic values --------------------------------------===*/ LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty, @@ -75,6 +84,31 @@ LLVMBool LLVMCreateJITCompilerForModule(LLVMExecutionEngineRef *OutJIT, unsigned OptLevel, char **OutError); +void LLVMInitializeMCJITCompilerOptions( + struct LLVMMCJITCompilerOptions *Options, size_t SizeOfOptions); + +/** + * Create an MCJIT execution engine for a module, with the given options. It is + * the responsibility of the caller to ensure that all fields in Options up to + * the given SizeOfOptions are initialized. It is correct to pass a smaller + * value of SizeOfOptions that omits some fields. The canonical way of using + * this is: + * + * LLVMMCJITCompilerOptions options; + * LLVMInitializeMCJITCompilerOptions(&options, sizeof(options)); + * ... fill in those options you care about + * LLVMCreateMCJITCompilerForModule(&jit, mod, &options, sizeof(options), + * &error); + * + * Note that this is also correct, though possibly suboptimal: + * + * LLVMCreateMCJITCompilerForModule(&jit, mod, 0, 0, &error); + */ +LLVMBool LLVMCreateMCJITCompilerForModule( + LLVMExecutionEngineRef *OutJIT, LLVMModuleRef M, + struct LLVMMCJITCompilerOptions *Options, size_t SizeOfOptions, + char **OutError); + /** Deprecated: Use LLVMCreateExecutionEngineForModule instead. */ LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE, LLVMModuleProviderRef MP, @@ -123,7 +157,8 @@ LLVMBool LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE, LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name, LLVMValueRef *OutFn); -void *LLVMRecompileAndRelinkFunction(LLVMExecutionEngineRef EE, LLVMValueRef Fn); +void *LLVMRecompileAndRelinkFunction(LLVMExecutionEngineRef EE, + LLVMValueRef Fn); LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE); @@ -137,27 +172,7 @@ void *LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global); */ #ifdef __cplusplus -} - -namespace llvm { - struct GenericValue; - class ExecutionEngine; - - #define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \ - inline ty *unwrap(ref P) { \ - return reinterpret_cast<ty*>(P); \ - } \ - \ - inline ref wrap(const ty *P) { \ - return reinterpret_cast<ref>(const_cast<ty*>(P)); \ - } - - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(GenericValue, LLVMGenericValueRef ) - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ExecutionEngine, LLVMExecutionEngineRef) - - #undef DEFINE_SIMPLE_CONVERSION_FUNCTIONS -} - +} #endif /* defined(__cplusplus) */ #endif diff --git a/contrib/llvm/include/llvm-c/Object.h b/contrib/llvm/include/llvm-c/Object.h index e2dad62..ecccfee 100644 --- a/contrib/llvm/include/llvm-c/Object.h +++ b/contrib/llvm/include/llvm-c/Object.h @@ -23,8 +23,6 @@ #include "llvm/Config/llvm-config.h" #ifdef __cplusplus -#include "llvm/Object/ObjectFile.h" - extern "C" { #endif @@ -99,50 +97,6 @@ const char *LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI); #ifdef __cplusplus } - -namespace llvm { - namespace object { - inline ObjectFile *unwrap(LLVMObjectFileRef OF) { - return reinterpret_cast<ObjectFile*>(OF); - } - - inline LLVMObjectFileRef wrap(const ObjectFile *OF) { - return reinterpret_cast<LLVMObjectFileRef>(const_cast<ObjectFile*>(OF)); - } - - inline section_iterator *unwrap(LLVMSectionIteratorRef SI) { - return reinterpret_cast<section_iterator*>(SI); - } - - inline LLVMSectionIteratorRef - wrap(const section_iterator *SI) { - return reinterpret_cast<LLVMSectionIteratorRef> - (const_cast<section_iterator*>(SI)); - } - - inline symbol_iterator *unwrap(LLVMSymbolIteratorRef SI) { - return reinterpret_cast<symbol_iterator*>(SI); - } - - inline LLVMSymbolIteratorRef - wrap(const symbol_iterator *SI) { - return reinterpret_cast<LLVMSymbolIteratorRef> - (const_cast<symbol_iterator*>(SI)); - } - - inline relocation_iterator *unwrap(LLVMRelocationIteratorRef SI) { - return reinterpret_cast<relocation_iterator*>(SI); - } - - inline LLVMRelocationIteratorRef - wrap(const relocation_iterator *SI) { - return reinterpret_cast<LLVMRelocationIteratorRef> - (const_cast<relocation_iterator*>(SI)); - } - - } -} - #endif /* defined(__cplusplus) */ #endif diff --git a/contrib/llvm/include/llvm-c/Target.h b/contrib/llvm/include/llvm-c/Target.h index 57abfa0..80fc3e5 100644 --- a/contrib/llvm/include/llvm-c/Target.h +++ b/contrib/llvm/include/llvm-c/Target.h @@ -235,29 +235,6 @@ void LLVMDisposeTargetData(LLVMTargetDataRef); #ifdef __cplusplus } - -namespace llvm { - class DataLayout; - class TargetLibraryInfo; - - inline DataLayout *unwrap(LLVMTargetDataRef P) { - return reinterpret_cast<DataLayout*>(P); - } - - inline LLVMTargetDataRef wrap(const DataLayout *P) { - return reinterpret_cast<LLVMTargetDataRef>(const_cast<DataLayout*>(P)); - } - - inline TargetLibraryInfo *unwrap(LLVMTargetLibraryInfoRef P) { - return reinterpret_cast<TargetLibraryInfo*>(P); - } - - inline LLVMTargetLibraryInfoRef wrap(const TargetLibraryInfo *P) { - TargetLibraryInfo *X = const_cast<TargetLibraryInfo*>(P); - return reinterpret_cast<LLVMTargetLibraryInfoRef>(X); - } -} - #endif /* defined(__cplusplus) */ #endif diff --git a/contrib/llvm/include/llvm-c/TargetMachine.h b/contrib/llvm/include/llvm-c/TargetMachine.h index 691abdf..5e35595 100644 --- a/contrib/llvm/include/llvm-c/TargetMachine.h +++ b/contrib/llvm/include/llvm-c/TargetMachine.h @@ -25,7 +25,7 @@ #ifdef __cplusplus extern "C" { #endif -typedef struct LLVMTargetMachine *LLVMTargetMachineRef; +typedef struct LLVMOpaqueTargetMachine *LLVMTargetMachineRef; typedef struct LLVMTarget *LLVMTargetRef; typedef enum { @@ -114,30 +114,11 @@ LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T); LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M, char *Filename, LLVMCodeGenFileType codegen, char **ErrorMessage); - - - +/** Compile the LLVM IR stored in \p M and store the result in \p OutMemBuf. */ +LLVMBool LLVMTargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T, LLVMModuleRef M, + LLVMCodeGenFileType codegen, char** ErrorMessage, LLVMMemoryBufferRef *OutMemBuf); #ifdef __cplusplus } - -namespace llvm { - class TargetMachine; - class Target; - - inline TargetMachine *unwrap(LLVMTargetMachineRef P) { - return reinterpret_cast<TargetMachine*>(P); - } - inline Target *unwrap(LLVMTargetRef P) { - return reinterpret_cast<Target*>(P); - } - inline LLVMTargetMachineRef wrap(const TargetMachine *P) { - return reinterpret_cast<LLVMTargetMachineRef>( - const_cast<TargetMachine*>(P)); - } - inline LLVMTargetRef wrap(const Target * P) { - return reinterpret_cast<LLVMTargetRef>(const_cast<Target*>(P)); - } -} #endif #endif diff --git a/contrib/llvm/include/llvm-c/Transforms/PassManagerBuilder.h b/contrib/llvm/include/llvm-c/Transforms/PassManagerBuilder.h index 82e513d..545f8aa 100644 --- a/contrib/llvm/include/llvm-c/Transforms/PassManagerBuilder.h +++ b/contrib/llvm/include/llvm-c/Transforms/PassManagerBuilder.h @@ -86,16 +86,6 @@ void LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB, #ifdef __cplusplus } - -namespace llvm { - inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) { - return reinterpret_cast<PassManagerBuilder*>(P); - } - - inline LLVMPassManagerBuilderRef wrap(PassManagerBuilder *P) { - return reinterpret_cast<LLVMPassManagerBuilderRef>(P); - } -} #endif #endif diff --git a/contrib/llvm/include/llvm-c/Transforms/Vectorize.h b/contrib/llvm/include/llvm-c/Transforms/Vectorize.h index 68a9bdd..c9102da 100644 --- a/contrib/llvm/include/llvm-c/Transforms/Vectorize.h +++ b/contrib/llvm/include/llvm-c/Transforms/Vectorize.h @@ -39,6 +39,9 @@ void LLVMAddBBVectorizePass(LLVMPassManagerRef PM); /** See llvm::createLoopVectorizePass function. */ void LLVMAddLoopVectorizePass(LLVMPassManagerRef PM); +/** See llvm::createSLPVectorizerPass function. */ +void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM); + /** * @} */ |