diff options
author | Stephen Hines <srhines@google.com> | 2014-12-01 14:51:49 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-12-02 16:08:10 -0800 |
commit | 37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch) | |
tree | 8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /include/llvm-c | |
parent | d2327b22152ced7bc46dc629fc908959e8a52d03 (diff) | |
download | external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2 |
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'include/llvm-c')
-rw-r--r-- | include/llvm-c/BitReader.h | 4 | ||||
-rw-r--r-- | include/llvm-c/BitWriter.h | 7 | ||||
-rw-r--r-- | include/llvm-c/Core.h | 122 | ||||
-rw-r--r-- | include/llvm-c/Disassembler.h | 20 | ||||
-rw-r--r-- | include/llvm-c/ExecutionEngine.h | 1 | ||||
-rw-r--r-- | include/llvm-c/Initialization.h | 4 | ||||
-rw-r--r-- | include/llvm-c/Support.h | 11 | ||||
-rw-r--r-- | include/llvm-c/Transforms/Scalar.h | 12 | ||||
-rw-r--r-- | include/llvm-c/lto.h | 56 |
9 files changed, 219 insertions, 18 deletions
diff --git a/include/llvm-c/BitReader.h b/include/llvm-c/BitReader.h index 7af209b..f3b388b 100644 --- a/include/llvm-c/BitReader.h +++ b/include/llvm-c/BitReader.h @@ -16,8 +16,8 @@ |* *| \*===----------------------------------------------------------------------===*/ -#ifndef LLVM_C_BITCODEREADER_H -#define LLVM_C_BITCODEREADER_H +#ifndef LLVM_C_BITREADER_H +#define LLVM_C_BITREADER_H #include "llvm-c/Core.h" diff --git a/include/llvm-c/BitWriter.h b/include/llvm-c/BitWriter.h index f605e24..f25ad3a 100644 --- a/include/llvm-c/BitWriter.h +++ b/include/llvm-c/BitWriter.h @@ -16,8 +16,8 @@ |* *| \*===----------------------------------------------------------------------===*/ -#ifndef LLVM_C_BITCODEWRITER_H -#define LLVM_C_BITCODEWRITER_H +#ifndef LLVM_C_BITWRITER_H +#define LLVM_C_BITWRITER_H #include "llvm-c/Core.h" @@ -45,6 +45,9 @@ int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose, descriptor. Returns 0 on success. Closes the Handle. */ int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle); +/** Writes a module to a new memory buffer and returns it. */ +LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M); + /** * @} */ diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index 8693a30..30c7595 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -168,6 +168,7 @@ typedef enum { LLVMInAllocaAttribute = 1ULL << 36, LLVMNonNullAttribute = 1ULL << 37, LLVMJumpTableAttribute = 1ULL << 38, + LLVMDereferenceableAttribute = 1ULL << 39, */ } LLVMAttribute; @@ -559,6 +560,10 @@ LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID); */ LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID, LLVMContextRef C); +/** + * Return an exact copy of the specified module. + */ +LLVMModuleRef LLVMCloneModule(LLVMModuleRef M); /** * Destroy a module instance. @@ -1377,6 +1382,13 @@ LLVMValueRef LLVMGetUsedValue(LLVMUseRef U); LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index); /** + * Obtain the use of an operand at a specific index in a llvm::User value. + * + * @see llvm::User::getOperandUse() + */ +LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index); + +/** * Set an operand at a specific index in a llvm::User value. * * @see llvm::User::setOperand() @@ -1537,6 +1549,14 @@ unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal); long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal); /** + * Obtain the double value for an floating point constant value. + * losesInfo indicates if some precision was lost in the conversion. + * + * @see llvm::ConstantFP::getDoubleValue + */ +double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *losesInfo); + +/** * @} */ @@ -1569,6 +1589,20 @@ LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMBool DontNullTerminate); /** + * Returns true if the specified constant is an array of i8. + * + * @see ConstantDataSequential::getAsString() + */ +LLVMBool LLVMIsConstantString(LLVMValueRef c); + +/** + * Get the given constant data sequential as a string. + * + * @see ConstantDataSequential::getAsString() + */ +const char *LLVMGetAsString(LLVMValueRef c, size_t* out); + +/** * Create an anonymous ConstantStruct with the specified values. * * @see llvm::ConstantStruct::getAnon() @@ -1606,6 +1640,13 @@ LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, unsigned Count); /** + * Get an element at specified index as a constant. + * + * @see ConstantDataSequential::getElementAsConstant() + */ +LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef c, unsigned idx); + +/** * Create a ConstantVector from values. * * @see llvm::ConstantVector::get() @@ -2376,6 +2417,26 @@ LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst); LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst); /** + * Obtain the float predicate of an instruction. + * + * This is only valid for instructions that correspond to llvm::FCmpInst + * or llvm::ConstantExpr whose opcode is llvm::Instruction::FCmp. + * + * @see llvm::FCmpInst::getPredicate() + */ +LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst); + +/** + * Create a copy of 'this' instruction that is identical in all ways + * except the following: + * * The instruction has no parent + * * The instruction has no name + * + * @see llvm::Instruction::clone() + */ +LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst); + +/** * @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations * * Functions in this group apply to instructions that refer to call @@ -2436,6 +2497,63 @@ void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall); */ /** + * @defgroup LLVMCCoreValueInstructionTerminator Terminators + * + * Functions in this group only apply to instructions that map to + * llvm::TerminatorInst instances. + * + * @{ + */ + +/** + * Return the number of successors that this terminator has. + * + * @see llvm::TerminatorInst::getNumSuccessors + */ +unsigned LLVMGetNumSuccessors(LLVMValueRef Term); + +/** + * Return the specified successor. + * + * @see llvm::TerminatorInst::getSuccessor + */ +LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i); + +/** + * Update the specified successor to point at the provided block. + * + * @see llvm::TerminatorInst::setSuccessor + */ +void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block); + +/** + * Return if a branch is conditional. + * + * This only works on llvm::BranchInst instructions. + * + * @see llvm::BranchInst::isConditional + */ +LLVMBool LLVMIsConditional(LLVMValueRef Branch); + +/** + * Return the condition of a branch instruction. + * + * This only works on llvm::BranchInst instructions. + * + * @see llvm::BranchInst::getCondition + */ +LLVMValueRef LLVMGetCondition(LLVMValueRef Branch); + +/** + * Set the condition of a branch instruction. + * + * This only works on llvm::BranchInst instructions. + * + * @see llvm::BranchInst::setCondition + */ +void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond); + +/** * Obtain the default destination basic block of a switch instruction. * * This only works on llvm::SwitchInst instructions. @@ -2445,6 +2563,10 @@ void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall); LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef SwitchInstr); /** + * @} + */ + +/** * @defgroup LLVMCCoreValueInstructionPHINode PHI Nodes * * Functions in this group only apply to instructions that map to diff --git a/include/llvm-c/Disassembler.h b/include/llvm-c/Disassembler.h index 8f31150..d6cbe31 100644 --- a/include/llvm-c/Disassembler.h +++ b/include/llvm-c/Disassembler.h @@ -174,8 +174,8 @@ extern "C" { * by passing a block of information in the DisInfo parameter and specifying the * TagType and callback functions as described above. These can all be passed * as NULL. If successful, this returns a disassembler context. If not, it - * returns NULL. This function is equivalent to calling LLVMCreateDisasmCPU() - * with an empty CPU name. + * returns NULL. This function is equivalent to calling + * LLVMCreateDisasmCPUFeatures() with an empty CPU name and feature set. */ LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo, int TagType, LLVMOpInfoCallback GetOpInfo, @@ -186,7 +186,8 @@ LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo, * disassembly is supported by passing a block of information in the DisInfo * parameter and specifying the TagType and callback functions as described * above. These can all be passed * as NULL. If successful, this returns a - * disassembler context. If not, it returns NULL. + * disassembler context. If not, it returns NULL. This function is equivalent + * to calling LLVMCreateDisasmCPUFeatures() with an empty feature set. */ LLVMDisasmContextRef LLVMCreateDisasmCPU(const char *Triple, const char *CPU, void *DisInfo, int TagType, @@ -194,6 +195,19 @@ LLVMDisasmContextRef LLVMCreateDisasmCPU(const char *Triple, const char *CPU, LLVMSymbolLookupCallback SymbolLookUp); /** + * Create a disassembler for the TripleName, a specific CPU and specific feature + * string. Symbolic disassembly is supported by passing a block of information + * in the DisInfo parameter and specifying the TagType and callback functions as + * described above. These can all be passed * as NULL. If successful, this + * returns a disassembler context. If not, it returns NULL. + */ +LLVMDisasmContextRef +LLVMCreateDisasmCPUFeatures(const char *Triple, const char *CPU, + const char *Features, void *DisInfo, int TagType, + LLVMOpInfoCallback GetOpInfo, + LLVMSymbolLookupCallback SymbolLookUp); + +/** * Set the disassembler's options. Returns 1 if it can set the Options and 0 * otherwise. */ diff --git a/include/llvm-c/ExecutionEngine.h b/include/llvm-c/ExecutionEngine.h index 7cdf0d7..f1f4cad 100644 --- a/include/llvm-c/ExecutionEngine.h +++ b/include/llvm-c/ExecutionEngine.h @@ -34,7 +34,6 @@ extern "C" { * @{ */ -void LLVMLinkInJIT(void); void LLVMLinkInMCJIT(void); void LLVMLinkInInterpreter(void); diff --git a/include/llvm-c/Initialization.h b/include/llvm-c/Initialization.h index ada4738..44194f8 100644 --- a/include/llvm-c/Initialization.h +++ b/include/llvm-c/Initialization.h @@ -13,8 +13,8 @@ |* *| \*===----------------------------------------------------------------------===*/ -#ifndef LLVM_C_INITIALIZEPASSES_H -#define LLVM_C_INITIALIZEPASSES_H +#ifndef LLVM_C_INITIALIZATION_H +#define LLVM_C_INITIALIZATION_H #include "llvm-c/Core.h" diff --git a/include/llvm-c/Support.h b/include/llvm-c/Support.h index 4e6ff22..a9216d0 100644 --- a/include/llvm-c/Support.h +++ b/include/llvm-c/Support.h @@ -47,6 +47,17 @@ typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef; */ LLVMBool LLVMLoadLibraryPermanently(const char* Filename); +/** + * This function parses the given arguments using the LLVM command line parser. + * Note that the only stable thing about this function is its signature; you + * cannot rely on any particular set of command line arguments being interpreted + * the same way across LLVM versions. + * + * @see llvm::cl::ParseCommandLineOptions() + */ +void LLVMParseCommandLineOptions(int argc, const char *const *argv, + const char *Overview); + #ifdef __cplusplus } #endif diff --git a/include/llvm-c/Transforms/Scalar.h b/include/llvm-c/Transforms/Scalar.h index 9b820b2..7ad1ad1 100644 --- a/include/llvm-c/Transforms/Scalar.h +++ b/include/llvm-c/Transforms/Scalar.h @@ -35,6 +35,9 @@ extern "C" { /** See llvm::createAggressiveDCEPass function. */ void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM); +/** See llvm::createAlignmentFromAssumptionsPass function. */ +void LLVMAddAlignmentFromAssumptionsPass(LLVMPassManagerRef PM); + /** See llvm::createCFGSimplificationPass function. */ void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM); @@ -44,6 +47,9 @@ void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM); /** See llvm::createScalarizerPass function. */ void LLVMAddScalarizerPass(LLVMPassManagerRef PM); +/** See llvm::createMergedLoadStoreMotionPass function. */ +void LLVMAddMergedLoadStoreMotionPass(LLVMPassManagerRef PM); + /** See llvm::createGVNPass function. */ void LLVMAddGVNPass(LLVMPassManagerRef PM); @@ -83,6 +89,9 @@ void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM); /** See llvm::createPartiallyInlineLibCallsPass function. */ void LLVMAddPartiallyInlineLibCallsPass(LLVMPassManagerRef PM); +/** See llvm::createLowerSwitchPass function. */ +void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM); + /** See llvm::createPromoteMemoryToRegisterPass function. */ void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM); @@ -129,6 +138,9 @@ void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM); /** See llvm::createTypeBasedAliasAnalysisPass function */ void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM); +/** See llvm::createScopedNoAliasAAPass function */ +void LLVMAddScopedNoAliasAAPass(LLVMPassManagerRef PM); + /** See llvm::createBasicAliasAnalysisPass function */ void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM); diff --git a/include/llvm-c/lto.h b/include/llvm-c/lto.h index 51079896..3f30d6d 100644 --- a/include/llvm-c/lto.h +++ b/include/llvm-c/lto.h @@ -178,6 +178,35 @@ lto_module_create_from_memory_with_path(const void* mem, size_t length, const char *path); /** + * \brief Loads an object file in its own context. + * + * Loads an object file in its own LLVMContext. This function call is + * thread-safe. However, modules created this way should not be merged into an + * lto_code_gen_t using \a lto_codegen_add_module(). + * + * Returns NULL on error (check lto_get_error_message() for details). + * + * \since LTO_API_VERSION=11 + */ +extern lto_module_t +lto_module_create_in_local_context(const void *mem, size_t length, + const char *path); + +/** + * \brief Loads an object file in the codegen context. + * + * Loads an object file into the same context as \c cg. The module is safe to + * add using \a lto_codegen_add_module(). + * + * Returns NULL on error (check lto_get_error_message() for details). + * + * \since LTO_API_VERSION=11 + */ +extern lto_module_t +lto_module_create_in_codegen_context(const void *mem, size_t length, + const char *path, lto_code_gen_t cg); + +/** * Loads an object file from disk. The seek point of fd is not preserved. * Returns NULL on error (check lto_get_error_message() for details). * @@ -324,12 +353,27 @@ extern void lto_codegen_set_diagnostic_handler(lto_code_gen_t, * Instantiates a code generator. * Returns NULL on error (check lto_get_error_message() for details). * + * All modules added using \a lto_codegen_add_module() must have been created + * in the same context as the codegen. + * * \since prior to LTO_API_VERSION=3 */ extern lto_code_gen_t lto_codegen_create(void); /** + * \brief Instantiate a code generator in its own context. + * + * Instantiates a code generator in its own context. Modules added via \a + * lto_codegen_add_module() must have all been created in the same context, + * using \a lto_module_create_in_codegen_context(). + * + * \since LTO_API_VERSION=11 + */ +extern lto_code_gen_t +lto_codegen_create_in_local_context(void); + +/** * Frees all code generator and all memory it internally allocated. * Upon return the lto_code_gen_t is no longer valid. * @@ -342,6 +386,10 @@ lto_codegen_dispose(lto_code_gen_t); * Add an object module to the set of modules for which code will be generated. * Returns true on error (check lto_get_error_message() for details). * + * \c cg and \c mod must both be in the same context. See \a + * lto_codegen_create_in_local_context() and \a + * lto_module_create_in_codegen_context(). + * * \since prior to LTO_API_VERSION=3 */ extern lto_bool_t @@ -375,14 +423,6 @@ lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model); extern void lto_codegen_set_cpu(lto_code_gen_t cg, const char *cpu); -/** - * Sets attributes for the cpu to generate code for. - * - * \since LTO_API_VERSION=11 - */ -extern void -lto_codegen_set_attr(lto_code_gen_t cg, const char *attr); - /** * Sets the location of the assembler tool to run. If not set, libLTO |