initial
This commit is contained in:
65
thirdparty/clang/include/llvm-c/Analysis.h
vendored
Normal file
65
thirdparty/clang/include/llvm-c/Analysis.h
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/*===-- llvm-c/Analysis.h - Analysis Library C Interface --------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMAnalysis.a, which *|
|
||||
|* implements various analyses of the LLVM IR. *|
|
||||
|* *|
|
||||
|* Many exotic languages can interoperate with C code but have a harder time *|
|
||||
|* with C++ due to name mangling. So in addition to C, this interface enables *|
|
||||
|* tools written in such languages. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_ANALYSIS_H
|
||||
#define LLVM_C_ANALYSIS_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCAnalysis Analysis
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
LLVMAbortProcessAction, /* verifier will print to stderr and abort() */
|
||||
LLVMPrintMessageAction, /* verifier will print to stderr and return 1 */
|
||||
LLVMReturnStatusAction /* verifier will just return 1 */
|
||||
} LLVMVerifierFailureAction;
|
||||
|
||||
|
||||
/* Verifies that a module is valid, taking the specified action if not.
|
||||
Optionally returns a human-readable description of any invalid constructs.
|
||||
OutMessage must be disposed with LLVMDisposeMessage. */
|
||||
LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
|
||||
char **OutMessage);
|
||||
|
||||
/* Verifies that a single function is valid, taking the specified action. Useful
|
||||
for debugging. */
|
||||
LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action);
|
||||
|
||||
/* Open up a ghostview window that displays the CFG of the current function.
|
||||
Useful for debugging. */
|
||||
void LLVMViewFunctionCFG(LLVMValueRef Fn);
|
||||
void LLVMViewFunctionCFGOnly(LLVMValueRef Fn);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
76
thirdparty/clang/include/llvm-c/BitReader.h
vendored
Normal file
76
thirdparty/clang/include/llvm-c/BitReader.h
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
/*===-- llvm-c/BitReader.h - BitReader Library C Interface ------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMBitReader.a, which *|
|
||||
|* implements input of the LLVM bitcode format. *|
|
||||
|* *|
|
||||
|* Many exotic languages can interoperate with C code but have a harder time *|
|
||||
|* with C++ due to name mangling. So in addition to C, this interface enables *|
|
||||
|* tools written in such languages. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_BITCODEREADER_H
|
||||
#define LLVM_C_BITCODEREADER_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCBitReader Bit Reader
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Builds a module from the bitcode in the specified memory buffer, returning a
|
||||
reference to the module via the OutModule parameter. Returns 0 on success.
|
||||
Optionally returns a human-readable error message via OutMessage. */
|
||||
LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf,
|
||||
LLVMModuleRef *OutModule, char **OutMessage);
|
||||
|
||||
LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
|
||||
LLVMMemoryBufferRef MemBuf,
|
||||
LLVMModuleRef *OutModule, char **OutMessage);
|
||||
|
||||
/** Reads a module from the specified path, returning via the OutMP parameter
|
||||
a module provider which performs lazy deserialization. Returns 0 on success.
|
||||
Optionally returns a human-readable error message via OutMessage. */
|
||||
LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
|
||||
LLVMMemoryBufferRef MemBuf,
|
||||
LLVMModuleRef *OutM,
|
||||
char **OutMessage);
|
||||
|
||||
LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
|
||||
char **OutMessage);
|
||||
|
||||
|
||||
/** Deprecated: Use LLVMGetBitcodeModuleInContext instead. */
|
||||
LLVMBool LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef,
|
||||
LLVMMemoryBufferRef MemBuf,
|
||||
LLVMModuleProviderRef *OutMP,
|
||||
char **OutMessage);
|
||||
|
||||
/** Deprecated: Use LLVMGetBitcodeModule instead. */
|
||||
LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf,
|
||||
LLVMModuleProviderRef *OutMP,
|
||||
char **OutMessage);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
56
thirdparty/clang/include/llvm-c/BitWriter.h
vendored
Normal file
56
thirdparty/clang/include/llvm-c/BitWriter.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/*===-- llvm-c/BitWriter.h - BitWriter Library C Interface ------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMBitWriter.a, which *|
|
||||
|* implements output of the LLVM bitcode format. *|
|
||||
|* *|
|
||||
|* Many exotic languages can interoperate with C code but have a harder time *|
|
||||
|* with C++ due to name mangling. So in addition to C, this interface enables *|
|
||||
|* tools written in such languages. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_BITCODEWRITER_H
|
||||
#define LLVM_C_BITCODEWRITER_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCBitWriter Bit Writer
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*===-- Operations on modules ---------------------------------------------===*/
|
||||
|
||||
/** Writes a module to the specified path. Returns 0 on success. */
|
||||
int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path);
|
||||
|
||||
/** Writes a module to an open file descriptor. Returns 0 on success. */
|
||||
int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
|
||||
int Unbuffered);
|
||||
|
||||
/** Deprecated for LLVMWriteBitcodeToFD. Writes a module to an open file
|
||||
descriptor. Returns 0 on success. Closes the Handle. */
|
||||
int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
2789
thirdparty/clang/include/llvm-c/Core.h
vendored
Normal file
2789
thirdparty/clang/include/llvm-c/Core.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
201
thirdparty/clang/include/llvm-c/Disassembler.h
vendored
Normal file
201
thirdparty/clang/include/llvm-c/Disassembler.h
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
/*===-- llvm-c/Disassembler.h - Disassembler Public C Interface ---*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header provides a public interface to a disassembler library. *|
|
||||
|* LLVM provides an implementation of this interface. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_DISASSEMBLER_H
|
||||
#define LLVM_C_DISASSEMBLER_H
|
||||
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCDisassembler Disassembler
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* An opaque reference to a disassembler context.
|
||||
*/
|
||||
typedef void *LLVMDisasmContextRef;
|
||||
|
||||
/**
|
||||
* The type for the operand information call back function. This is called to
|
||||
* get the symbolic information for an operand of an instruction. Typically
|
||||
* this is from the relocation information, symbol table, etc. That block of
|
||||
* information is saved when the disassembler context is created and passed to
|
||||
* the call back in the DisInfo parameter. The instruction containing operand
|
||||
* is at the PC parameter. For some instruction sets, there can be more than
|
||||
* one operand with symbolic information. To determine the symbolic operand
|
||||
* information for each operand, the bytes for the specific operand in the
|
||||
* instruction are specified by the Offset parameter and its byte widith is the
|
||||
* size parameter. For instructions sets with fixed widths and one symbolic
|
||||
* operand per instruction, the Offset parameter will be zero and Size parameter
|
||||
* will be the instruction width. The information is returned in TagBuf and is
|
||||
* Triple specific with its specific information defined by the value of
|
||||
* TagType for that Triple. If symbolic information is returned the function
|
||||
* returns 1, otherwise it returns 0.
|
||||
*/
|
||||
typedef int (*LLVMOpInfoCallback)(void *DisInfo, uint64_t PC,
|
||||
uint64_t Offset, uint64_t Size,
|
||||
int TagType, void *TagBuf);
|
||||
|
||||
/**
|
||||
* The initial support in LLVM MC for the most general form of a relocatable
|
||||
* expression is "AddSymbol - SubtractSymbol + Offset". For some Darwin targets
|
||||
* this full form is encoded in the relocation information so that AddSymbol and
|
||||
* SubtractSymbol can be link edited independent of each other. Many other
|
||||
* platforms only allow a relocatable expression of the form AddSymbol + Offset
|
||||
* to be encoded.
|
||||
*
|
||||
* The LLVMOpInfoCallback() for the TagType value of 1 uses the struct
|
||||
* LLVMOpInfo1. The value of the relocatable expression for the operand,
|
||||
* including any PC adjustment, is passed in to the call back in the Value
|
||||
* field. The symbolic information about the operand is returned using all
|
||||
* the fields of the structure with the Offset of the relocatable expression
|
||||
* returned in the Value field. It is possible that some symbols in the
|
||||
* relocatable expression were assembly temporary symbols, for example
|
||||
* "Ldata - LpicBase + constant", and only the Values of the symbols without
|
||||
* symbol names are present in the relocation information. The VariantKind
|
||||
* type is one of the Target specific #defines below and is used to print
|
||||
* operands like "_foo@GOT", ":lower16:_foo", etc.
|
||||
*/
|
||||
struct LLVMOpInfoSymbol1 {
|
||||
uint64_t Present; /* 1 if this symbol is present */
|
||||
const char *Name; /* symbol name if not NULL */
|
||||
uint64_t Value; /* symbol value if name is NULL */
|
||||
};
|
||||
|
||||
struct LLVMOpInfo1 {
|
||||
struct LLVMOpInfoSymbol1 AddSymbol;
|
||||
struct LLVMOpInfoSymbol1 SubtractSymbol;
|
||||
uint64_t Value;
|
||||
uint64_t VariantKind;
|
||||
};
|
||||
|
||||
/**
|
||||
* The operand VariantKinds for symbolic disassembly.
|
||||
*/
|
||||
#define LLVMDisassembler_VariantKind_None 0 /* all targets */
|
||||
|
||||
/**
|
||||
* The ARM target VariantKinds.
|
||||
*/
|
||||
#define LLVMDisassembler_VariantKind_ARM_HI16 1 /* :upper16: */
|
||||
#define LLVMDisassembler_VariantKind_ARM_LO16 2 /* :lower16: */
|
||||
|
||||
/**
|
||||
* The type for the symbol lookup function. This may be called by the
|
||||
* disassembler for things like adding a comment for a PC plus a constant
|
||||
* offset load instruction to use a symbol name instead of a load address value.
|
||||
* It is passed the block information is saved when the disassembler context is
|
||||
* created and the ReferenceValue to look up as a symbol. If no symbol is found
|
||||
* for the ReferenceValue NULL is returned. The ReferenceType of the
|
||||
* instruction is passed indirectly as is the PC of the instruction in
|
||||
* ReferencePC. If the output reference can be determined its type is returned
|
||||
* indirectly in ReferenceType along with ReferenceName if any, or that is set
|
||||
* to NULL.
|
||||
*/
|
||||
typedef const char *(*LLVMSymbolLookupCallback)(void *DisInfo,
|
||||
uint64_t ReferenceValue,
|
||||
uint64_t *ReferenceType,
|
||||
uint64_t ReferencePC,
|
||||
const char **ReferenceName);
|
||||
/**
|
||||
* The reference types on input and output.
|
||||
*/
|
||||
/* No input reference type or no output reference type. */
|
||||
#define LLVMDisassembler_ReferenceType_InOut_None 0
|
||||
|
||||
/* The input reference is from a branch instruction. */
|
||||
#define LLVMDisassembler_ReferenceType_In_Branch 1
|
||||
/* The input reference is from a PC relative load instruction. */
|
||||
#define LLVMDisassembler_ReferenceType_In_PCrel_Load 2
|
||||
|
||||
/* The output reference is to as symbol stub. */
|
||||
#define LLVMDisassembler_ReferenceType_Out_SymbolStub 1
|
||||
/* The output reference is to a symbol address in a literal pool. */
|
||||
#define LLVMDisassembler_ReferenceType_Out_LitPool_SymAddr 2
|
||||
/* The output reference is to a cstring address in a literal pool. */
|
||||
#define LLVMDisassembler_ReferenceType_Out_LitPool_CstrAddr 3
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* !defined(__cplusplus) */
|
||||
|
||||
/**
|
||||
* Create a disassembler for the TripleName. 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. This function is equivalent to calling LLVMCreateDisasmCPU()
|
||||
* with an empty CPU name.
|
||||
*/
|
||||
LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo,
|
||||
int TagType, LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp);
|
||||
|
||||
/**
|
||||
* Create a disassembler for the TripleName and a specific CPU. 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 LLVMCreateDisasmCPU(const char *Triple, const char *CPU,
|
||||
void *DisInfo, int TagType,
|
||||
LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp);
|
||||
|
||||
/**
|
||||
* Set the disassembler's options. Returns 1 if it can set the Options and 0
|
||||
* otherwise.
|
||||
*/
|
||||
int LLVMSetDisasmOptions(LLVMDisasmContextRef DC, uint64_t Options);
|
||||
|
||||
/* The option to produce marked up assembly. */
|
||||
#define LLVMDisassembler_Option_UseMarkup 1
|
||||
/* The option to print immediates as hex. */
|
||||
#define LLVMDisassembler_Option_PrintImmHex 2
|
||||
/* The option use the other assembler printer variant */
|
||||
#define LLVMDisassembler_Option_AsmPrinterVariant 4
|
||||
|
||||
/**
|
||||
* Dispose of a disassembler context.
|
||||
*/
|
||||
void LLVMDisasmDispose(LLVMDisasmContextRef DC);
|
||||
|
||||
/**
|
||||
* Disassemble a single instruction using the disassembler context specified in
|
||||
* the parameter DC. The bytes of the instruction are specified in the
|
||||
* parameter Bytes, and contains at least BytesSize number of bytes. The
|
||||
* instruction is at the address specified by the PC parameter. If a valid
|
||||
* instruction can be disassembled, its string is returned indirectly in
|
||||
* OutString whose size is specified in the parameter OutStringSize. This
|
||||
* function returns the number of bytes in the instruction or zero if there was
|
||||
* no valid instruction.
|
||||
*/
|
||||
size_t LLVMDisasmInstruction(LLVMDisasmContextRef DC, uint8_t *Bytes,
|
||||
uint64_t BytesSize, uint64_t PC,
|
||||
char *OutString, size_t OutStringSize);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* !defined(__cplusplus) */
|
||||
|
||||
#endif /* !defined(LLVM_C_DISASSEMBLER_H) */
|
||||
530
thirdparty/clang/include/llvm-c/EnhancedDisassembly.h
vendored
Normal file
530
thirdparty/clang/include/llvm-c/EnhancedDisassembly.h
vendored
Normal file
@@ -0,0 +1,530 @@
|
||||
/*===-- llvm-c/EnhancedDisassembly.h - Disassembler C Interface ---*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to EnhancedDisassembly.so, which *|
|
||||
|* implements a disassembler with the ability to extract operand values and *|
|
||||
|* individual tokens from assembly instructions. *|
|
||||
|* *|
|
||||
|* The header declares additional interfaces if the host compiler supports *|
|
||||
|* the blocks API. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_ENHANCEDDISASSEMBLY_H
|
||||
#define LLVM_C_ENHANCEDDISASSEMBLY_H
|
||||
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCEnhancedDisassembly Enhanced Disassembly
|
||||
* @ingroup LLVMC
|
||||
* @deprecated
|
||||
*
|
||||
* This module contains an interface to the Enhanced Disassembly (edis)
|
||||
* library. The edis library is deprecated and will likely disappear in
|
||||
* the near future. You should use the @ref LLVMCDisassembler interface
|
||||
* instead.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
@typedef EDByteReaderCallback
|
||||
Interface to memory from which instructions may be read.
|
||||
@param byte A pointer whose target should be filled in with the data returned.
|
||||
@param address The address of the byte to be read.
|
||||
@param arg An anonymous argument for client use.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
typedef int (*EDByteReaderCallback)(uint8_t *byte, uint64_t address, void *arg);
|
||||
|
||||
/*!
|
||||
@typedef EDRegisterReaderCallback
|
||||
Interface to registers from which registers may be read.
|
||||
@param value A pointer whose target should be filled in with the value of the
|
||||
register.
|
||||
@param regID The LLVM register identifier for the register to read.
|
||||
@param arg An anonymous argument for client use.
|
||||
@result 0 if the register could be read; -1 otherwise.
|
||||
*/
|
||||
typedef int (*EDRegisterReaderCallback)(uint64_t *value, unsigned regID,
|
||||
void* arg);
|
||||
|
||||
/*!
|
||||
@typedef EDAssemblySyntax_t
|
||||
An assembly syntax for use in tokenizing instructions.
|
||||
*/
|
||||
enum {
|
||||
/*! @constant kEDAssemblySyntaxX86Intel Intel syntax for i386 and x86_64. */
|
||||
kEDAssemblySyntaxX86Intel = 0,
|
||||
/*! @constant kEDAssemblySyntaxX86ATT AT&T syntax for i386 and x86_64. */
|
||||
kEDAssemblySyntaxX86ATT = 1,
|
||||
kEDAssemblySyntaxARMUAL = 2
|
||||
};
|
||||
typedef unsigned EDAssemblySyntax_t;
|
||||
|
||||
/*!
|
||||
@typedef EDDisassemblerRef
|
||||
Encapsulates a disassembler for a single CPU architecture.
|
||||
*/
|
||||
typedef void *EDDisassemblerRef;
|
||||
|
||||
/*!
|
||||
@typedef EDInstRef
|
||||
Encapsulates a single disassembled instruction in one assembly syntax.
|
||||
*/
|
||||
typedef void *EDInstRef;
|
||||
|
||||
/*!
|
||||
@typedef EDTokenRef
|
||||
Encapsulates a token from the disassembly of an instruction.
|
||||
*/
|
||||
typedef void *EDTokenRef;
|
||||
|
||||
/*!
|
||||
@typedef EDOperandRef
|
||||
Encapsulates an operand of an instruction.
|
||||
*/
|
||||
typedef void *EDOperandRef;
|
||||
|
||||
/*!
|
||||
@functiongroup Getting a disassembler
|
||||
*/
|
||||
|
||||
/*!
|
||||
@function EDGetDisassembler
|
||||
Gets the disassembler for a given target.
|
||||
@param disassembler A pointer whose target will be filled in with the
|
||||
disassembler.
|
||||
@param triple Identifies the target. Example: "x86_64-apple-darwin10"
|
||||
@param syntax The assembly syntax to use when decoding instructions.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDGetDisassembler(EDDisassemblerRef *disassembler,
|
||||
const char *triple,
|
||||
EDAssemblySyntax_t syntax);
|
||||
|
||||
/*!
|
||||
@functiongroup Generic architectural queries
|
||||
*/
|
||||
|
||||
/*!
|
||||
@function EDGetRegisterName
|
||||
Gets the human-readable name for a given register.
|
||||
@param regName A pointer whose target will be pointed at the name of the
|
||||
register. The name does not need to be deallocated and will be
|
||||
@param disassembler The disassembler to query for the name.
|
||||
@param regID The register identifier, as returned by EDRegisterTokenValue.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDGetRegisterName(const char** regName,
|
||||
EDDisassemblerRef disassembler,
|
||||
unsigned regID);
|
||||
|
||||
/*!
|
||||
@function EDRegisterIsStackPointer
|
||||
Determines if a register is one of the platform's stack-pointer registers.
|
||||
@param disassembler The disassembler to query.
|
||||
@param regID The register identifier, as returned by EDRegisterTokenValue.
|
||||
@result 1 if true; 0 otherwise.
|
||||
*/
|
||||
int EDRegisterIsStackPointer(EDDisassemblerRef disassembler,
|
||||
unsigned regID);
|
||||
|
||||
/*!
|
||||
@function EDRegisterIsProgramCounter
|
||||
Determines if a register is one of the platform's stack-pointer registers.
|
||||
@param disassembler The disassembler to query.
|
||||
@param regID The register identifier, as returned by EDRegisterTokenValue.
|
||||
@result 1 if true; 0 otherwise.
|
||||
*/
|
||||
int EDRegisterIsProgramCounter(EDDisassemblerRef disassembler,
|
||||
unsigned regID);
|
||||
|
||||
/*!
|
||||
@functiongroup Creating and querying instructions
|
||||
*/
|
||||
|
||||
/*!
|
||||
@function EDCreateInst
|
||||
Gets a set of contiguous instructions from a disassembler.
|
||||
@param insts A pointer to an array that will be filled in with the
|
||||
instructions. Must have at least count entries. Entries not filled in will
|
||||
be set to NULL.
|
||||
@param count The maximum number of instructions to fill in.
|
||||
@param disassembler The disassembler to use when decoding the instructions.
|
||||
@param byteReader The function to use when reading the instruction's machine
|
||||
code.
|
||||
@param address The address of the first byte of the instruction.
|
||||
@param arg An anonymous argument to be passed to byteReader.
|
||||
@result The number of instructions read on success; 0 otherwise.
|
||||
*/
|
||||
unsigned int EDCreateInsts(EDInstRef *insts,
|
||||
unsigned int count,
|
||||
EDDisassemblerRef disassembler,
|
||||
EDByteReaderCallback byteReader,
|
||||
uint64_t address,
|
||||
void *arg);
|
||||
|
||||
/*!
|
||||
@function EDReleaseInst
|
||||
Frees the memory for an instruction. The instruction can no longer be accessed
|
||||
after this call.
|
||||
@param inst The instruction to be freed.
|
||||
*/
|
||||
void EDReleaseInst(EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@function EDInstByteSize
|
||||
@param inst The instruction to be queried.
|
||||
@result The number of bytes in the instruction's machine-code representation.
|
||||
*/
|
||||
int EDInstByteSize(EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@function EDGetInstString
|
||||
Gets the disassembled text equivalent of the instruction.
|
||||
@param buf A pointer whose target will be filled in with a pointer to the
|
||||
string. (The string becomes invalid when the instruction is released.)
|
||||
@param inst The instruction to be queried.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDGetInstString(const char **buf,
|
||||
EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@function EDInstID
|
||||
@param instID A pointer whose target will be filled in with the LLVM identifier
|
||||
for the instruction.
|
||||
@param inst The instruction to be queried.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDInstID(unsigned *instID, EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@function EDInstIsBranch
|
||||
@param inst The instruction to be queried.
|
||||
@result 1 if the instruction is a branch instruction; 0 if it is some other
|
||||
type of instruction; -1 if there was an error.
|
||||
*/
|
||||
int EDInstIsBranch(EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@function EDInstIsMove
|
||||
@param inst The instruction to be queried.
|
||||
@result 1 if the instruction is a move instruction; 0 if it is some other
|
||||
type of instruction; -1 if there was an error.
|
||||
*/
|
||||
int EDInstIsMove(EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@function EDBranchTargetID
|
||||
@param inst The instruction to be queried.
|
||||
@result The ID of the branch target operand, suitable for use with
|
||||
EDCopyOperand. -1 if no such operand exists.
|
||||
*/
|
||||
int EDBranchTargetID(EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@function EDMoveSourceID
|
||||
@param inst The instruction to be queried.
|
||||
@result The ID of the move source operand, suitable for use with
|
||||
EDCopyOperand. -1 if no such operand exists.
|
||||
*/
|
||||
int EDMoveSourceID(EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@function EDMoveTargetID
|
||||
@param inst The instruction to be queried.
|
||||
@result The ID of the move source operand, suitable for use with
|
||||
EDCopyOperand. -1 if no such operand exists.
|
||||
*/
|
||||
int EDMoveTargetID(EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@functiongroup Creating and querying tokens
|
||||
*/
|
||||
|
||||
/*!
|
||||
@function EDNumTokens
|
||||
@param inst The instruction to be queried.
|
||||
@result The number of tokens in the instruction, or -1 on error.
|
||||
*/
|
||||
int EDNumTokens(EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@function EDGetToken
|
||||
Retrieves a token from an instruction. The token is valid until the
|
||||
instruction is released.
|
||||
@param token A pointer to be filled in with the token.
|
||||
@param inst The instruction to be queried.
|
||||
@param index The index of the token in the instruction.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDGetToken(EDTokenRef *token,
|
||||
EDInstRef inst,
|
||||
int index);
|
||||
|
||||
/*!
|
||||
@function EDGetTokenString
|
||||
Gets the disassembled text for a token.
|
||||
@param buf A pointer whose target will be filled in with a pointer to the
|
||||
string. (The string becomes invalid when the token is released.)
|
||||
@param token The token to be queried.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDGetTokenString(const char **buf,
|
||||
EDTokenRef token);
|
||||
|
||||
/*!
|
||||
@function EDOperandIndexForToken
|
||||
Returns the index of the operand to which a token belongs.
|
||||
@param token The token to be queried.
|
||||
@result The operand index on success; -1 otherwise
|
||||
*/
|
||||
int EDOperandIndexForToken(EDTokenRef token);
|
||||
|
||||
/*!
|
||||
@function EDTokenIsWhitespace
|
||||
@param token The token to be queried.
|
||||
@result 1 if the token is whitespace; 0 if not; -1 on error.
|
||||
*/
|
||||
int EDTokenIsWhitespace(EDTokenRef token);
|
||||
|
||||
/*!
|
||||
@function EDTokenIsPunctuation
|
||||
@param token The token to be queried.
|
||||
@result 1 if the token is punctuation; 0 if not; -1 on error.
|
||||
*/
|
||||
int EDTokenIsPunctuation(EDTokenRef token);
|
||||
|
||||
/*!
|
||||
@function EDTokenIsOpcode
|
||||
@param token The token to be queried.
|
||||
@result 1 if the token is opcode; 0 if not; -1 on error.
|
||||
*/
|
||||
int EDTokenIsOpcode(EDTokenRef token);
|
||||
|
||||
/*!
|
||||
@function EDTokenIsLiteral
|
||||
@param token The token to be queried.
|
||||
@result 1 if the token is a numeric literal; 0 if not; -1 on error.
|
||||
*/
|
||||
int EDTokenIsLiteral(EDTokenRef token);
|
||||
|
||||
/*!
|
||||
@function EDTokenIsRegister
|
||||
@param token The token to be queried.
|
||||
@result 1 if the token identifies a register; 0 if not; -1 on error.
|
||||
*/
|
||||
int EDTokenIsRegister(EDTokenRef token);
|
||||
|
||||
/*!
|
||||
@function EDTokenIsNegativeLiteral
|
||||
@param token The token to be queried.
|
||||
@result 1 if the token is a negative signed literal; 0 if not; -1 on error.
|
||||
*/
|
||||
int EDTokenIsNegativeLiteral(EDTokenRef token);
|
||||
|
||||
/*!
|
||||
@function EDLiteralTokenAbsoluteValue
|
||||
@param value A pointer whose target will be filled in with the absolute value
|
||||
of the literal.
|
||||
@param token The token to be queried.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDLiteralTokenAbsoluteValue(uint64_t *value,
|
||||
EDTokenRef token);
|
||||
|
||||
/*!
|
||||
@function EDRegisterTokenValue
|
||||
@param registerID A pointer whose target will be filled in with the LLVM
|
||||
register identifier for the token.
|
||||
@param token The token to be queried.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDRegisterTokenValue(unsigned *registerID,
|
||||
EDTokenRef token);
|
||||
|
||||
/*!
|
||||
@functiongroup Creating and querying operands
|
||||
*/
|
||||
|
||||
/*!
|
||||
@function EDNumOperands
|
||||
@param inst The instruction to be queried.
|
||||
@result The number of operands in the instruction, or -1 on error.
|
||||
*/
|
||||
int EDNumOperands(EDInstRef inst);
|
||||
|
||||
/*!
|
||||
@function EDGetOperand
|
||||
Retrieves an operand from an instruction. The operand is valid until the
|
||||
instruction is released.
|
||||
@param operand A pointer to be filled in with the operand.
|
||||
@param inst The instruction to be queried.
|
||||
@param index The index of the operand in the instruction.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDGetOperand(EDOperandRef *operand,
|
||||
EDInstRef inst,
|
||||
int index);
|
||||
|
||||
/*!
|
||||
@function EDOperandIsRegister
|
||||
@param operand The operand to be queried.
|
||||
@result 1 if the operand names a register; 0 if not; -1 on error.
|
||||
*/
|
||||
int EDOperandIsRegister(EDOperandRef operand);
|
||||
|
||||
/*!
|
||||
@function EDOperandIsImmediate
|
||||
@param operand The operand to be queried.
|
||||
@result 1 if the operand specifies an immediate value; 0 if not; -1 on error.
|
||||
*/
|
||||
int EDOperandIsImmediate(EDOperandRef operand);
|
||||
|
||||
/*!
|
||||
@function EDOperandIsMemory
|
||||
@param operand The operand to be queried.
|
||||
@result 1 if the operand specifies a location in memory; 0 if not; -1 on error.
|
||||
*/
|
||||
int EDOperandIsMemory(EDOperandRef operand);
|
||||
|
||||
/*!
|
||||
@function EDRegisterOperandValue
|
||||
@param value A pointer whose target will be filled in with the LLVM register ID
|
||||
of the register named by the operand.
|
||||
@param operand The operand to be queried.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDRegisterOperandValue(unsigned *value,
|
||||
EDOperandRef operand);
|
||||
|
||||
/*!
|
||||
@function EDImmediateOperandValue
|
||||
@param value A pointer whose target will be filled in with the value of the
|
||||
immediate.
|
||||
@param operand The operand to be queried.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
int EDImmediateOperandValue(uint64_t *value,
|
||||
EDOperandRef operand);
|
||||
|
||||
/*!
|
||||
@function EDEvaluateOperand
|
||||
Evaluates an operand using a client-supplied register state accessor. Register
|
||||
operands are evaluated by reading the value of the register; immediate operands
|
||||
are evaluated by reporting the immediate value; memory operands are evaluated
|
||||
by computing the target address (with only those relocations applied that were
|
||||
already applied to the original bytes).
|
||||
@param result A pointer whose target is to be filled with the result of
|
||||
evaluating the operand.
|
||||
@param operand The operand to be evaluated.
|
||||
@param regReader The function to use when reading registers from the register
|
||||
state.
|
||||
@param arg An anonymous argument for client use.
|
||||
@result 0 if the operand could be evaluated; -1 otherwise.
|
||||
*/
|
||||
int EDEvaluateOperand(uint64_t *result,
|
||||
EDOperandRef operand,
|
||||
EDRegisterReaderCallback regReader,
|
||||
void *arg);
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
|
||||
/*!
|
||||
@typedef EDByteBlock_t
|
||||
Block-based interface to memory from which instructions may be read.
|
||||
@param byte A pointer whose target should be filled in with the data returned.
|
||||
@param address The address of the byte to be read.
|
||||
@result 0 on success; -1 otherwise.
|
||||
*/
|
||||
typedef int (^EDByteBlock_t)(uint8_t *byte, uint64_t address);
|
||||
|
||||
/*!
|
||||
@typedef EDRegisterBlock_t
|
||||
Block-based interface to registers from which registers may be read.
|
||||
@param value A pointer whose target should be filled in with the value of the
|
||||
register.
|
||||
@param regID The LLVM register identifier for the register to read.
|
||||
@result 0 if the register could be read; -1 otherwise.
|
||||
*/
|
||||
typedef int (^EDRegisterBlock_t)(uint64_t *value, unsigned regID);
|
||||
|
||||
/*!
|
||||
@typedef EDTokenVisitor_t
|
||||
Block-based handler for individual tokens.
|
||||
@param token The current token being read.
|
||||
@result 0 to continue; 1 to stop normally; -1 on error.
|
||||
*/
|
||||
typedef int (^EDTokenVisitor_t)(EDTokenRef token);
|
||||
|
||||
/*! @functiongroup Block-based interfaces */
|
||||
|
||||
/*!
|
||||
@function EDBlockCreateInsts
|
||||
Gets a set of contiguous instructions from a disassembler, using a block to
|
||||
read memory.
|
||||
@param insts A pointer to an array that will be filled in with the
|
||||
instructions. Must have at least count entries. Entries not filled in will
|
||||
be set to NULL.
|
||||
@param count The maximum number of instructions to fill in.
|
||||
@param disassembler The disassembler to use when decoding the instructions.
|
||||
@param byteBlock The block to use when reading the instruction's machine
|
||||
code.
|
||||
@param address The address of the first byte of the instruction.
|
||||
@result The number of instructions read on success; 0 otherwise.
|
||||
*/
|
||||
unsigned int EDBlockCreateInsts(EDInstRef *insts,
|
||||
int count,
|
||||
EDDisassemblerRef disassembler,
|
||||
EDByteBlock_t byteBlock,
|
||||
uint64_t address);
|
||||
|
||||
/*!
|
||||
@function EDBlockEvaluateOperand
|
||||
Evaluates an operand using a block to read registers.
|
||||
@param result A pointer whose target is to be filled with the result of
|
||||
evaluating the operand.
|
||||
@param operand The operand to be evaluated.
|
||||
@param regBlock The block to use when reading registers from the register
|
||||
state.
|
||||
@result 0 if the operand could be evaluated; -1 otherwise.
|
||||
*/
|
||||
int EDBlockEvaluateOperand(uint64_t *result,
|
||||
EDOperandRef operand,
|
||||
EDRegisterBlock_t regBlock);
|
||||
|
||||
/*!
|
||||
@function EDBlockVisitTokens
|
||||
Visits every token with a visitor.
|
||||
@param inst The instruction with the tokens to be visited.
|
||||
@param visitor The visitor.
|
||||
@result 0 if the visit ended normally; -1 if the visitor encountered an error
|
||||
or there was some other error.
|
||||
*/
|
||||
int EDBlockVisitTokens(EDInstRef inst,
|
||||
EDTokenVisitor_t visitor);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
163
thirdparty/clang/include/llvm-c/ExecutionEngine.h
vendored
Normal file
163
thirdparty/clang/include/llvm-c/ExecutionEngine.h
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
/*===-- llvm-c/ExecutionEngine.h - ExecutionEngine Lib C Iface --*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMExecutionEngine.o, which *|
|
||||
|* implements various analyses of the LLVM IR. *|
|
||||
|* *|
|
||||
|* Many exotic languages can interoperate with C code but have a harder time *|
|
||||
|* with C++ due to name mangling. So in addition to C, this interface enables *|
|
||||
|* tools written in such languages. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_EXECUTIONENGINE_H
|
||||
#define LLVM_C_EXECUTIONENGINE_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm-c/Target.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCExecutionEngine Execution Engine
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
void LLVMLinkInJIT(void);
|
||||
void LLVMLinkInInterpreter(void);
|
||||
|
||||
typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef;
|
||||
typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef;
|
||||
|
||||
/*===-- Operations on generic values --------------------------------------===*/
|
||||
|
||||
LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty,
|
||||
unsigned long long N,
|
||||
LLVMBool IsSigned);
|
||||
|
||||
LLVMGenericValueRef LLVMCreateGenericValueOfPointer(void *P);
|
||||
|
||||
LLVMGenericValueRef LLVMCreateGenericValueOfFloat(LLVMTypeRef Ty, double N);
|
||||
|
||||
unsigned LLVMGenericValueIntWidth(LLVMGenericValueRef GenValRef);
|
||||
|
||||
unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenVal,
|
||||
LLVMBool IsSigned);
|
||||
|
||||
void *LLVMGenericValueToPointer(LLVMGenericValueRef GenVal);
|
||||
|
||||
double LLVMGenericValueToFloat(LLVMTypeRef TyRef, LLVMGenericValueRef GenVal);
|
||||
|
||||
void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal);
|
||||
|
||||
/*===-- Operations on execution engines -----------------------------------===*/
|
||||
|
||||
LLVMBool LLVMCreateExecutionEngineForModule(LLVMExecutionEngineRef *OutEE,
|
||||
LLVMModuleRef M,
|
||||
char **OutError);
|
||||
|
||||
LLVMBool LLVMCreateInterpreterForModule(LLVMExecutionEngineRef *OutInterp,
|
||||
LLVMModuleRef M,
|
||||
char **OutError);
|
||||
|
||||
LLVMBool LLVMCreateJITCompilerForModule(LLVMExecutionEngineRef *OutJIT,
|
||||
LLVMModuleRef M,
|
||||
unsigned OptLevel,
|
||||
char **OutError);
|
||||
|
||||
/** Deprecated: Use LLVMCreateExecutionEngineForModule instead. */
|
||||
LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE,
|
||||
LLVMModuleProviderRef MP,
|
||||
char **OutError);
|
||||
|
||||
/** Deprecated: Use LLVMCreateInterpreterForModule instead. */
|
||||
LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
|
||||
LLVMModuleProviderRef MP,
|
||||
char **OutError);
|
||||
|
||||
/** Deprecated: Use LLVMCreateJITCompilerForModule instead. */
|
||||
LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
|
||||
LLVMModuleProviderRef MP,
|
||||
unsigned OptLevel,
|
||||
char **OutError);
|
||||
|
||||
void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE);
|
||||
|
||||
void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE);
|
||||
|
||||
void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE);
|
||||
|
||||
int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE, LLVMValueRef F,
|
||||
unsigned ArgC, const char * const *ArgV,
|
||||
const char * const *EnvP);
|
||||
|
||||
LLVMGenericValueRef LLVMRunFunction(LLVMExecutionEngineRef EE, LLVMValueRef F,
|
||||
unsigned NumArgs,
|
||||
LLVMGenericValueRef *Args);
|
||||
|
||||
void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F);
|
||||
|
||||
void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M);
|
||||
|
||||
/** Deprecated: Use LLVMAddModule instead. */
|
||||
void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP);
|
||||
|
||||
LLVMBool LLVMRemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M,
|
||||
LLVMModuleRef *OutMod, char **OutError);
|
||||
|
||||
/** Deprecated: Use LLVMRemoveModule instead. */
|
||||
LLVMBool LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE,
|
||||
LLVMModuleProviderRef MP,
|
||||
LLVMModuleRef *OutMod, char **OutError);
|
||||
|
||||
LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name,
|
||||
LLVMValueRef *OutFn);
|
||||
|
||||
void *LLVMRecompileAndRelinkFunction(LLVMExecutionEngineRef EE, LLVMValueRef Fn);
|
||||
|
||||
LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE);
|
||||
|
||||
void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global,
|
||||
void* Addr);
|
||||
|
||||
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
|
||||
55
thirdparty/clang/include/llvm-c/Initialization.h
vendored
Normal file
55
thirdparty/clang/include/llvm-c/Initialization.h
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/*===-- llvm-c/Initialization.h - Initialization C Interface ------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to LLVM initialization routines, *|
|
||||
|* which must be called before you can use the functionality provided by *|
|
||||
|* the corresponding LLVM library. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_INITIALIZEPASSES_H
|
||||
#define LLVM_C_INITIALIZEPASSES_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCInitialization Initialization Routines
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* This module contains routines used to initialize the LLVM system.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
void LLVMInitializeCore(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeTransformUtils(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeScalarOpts(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeObjCARCOpts(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeVectorization(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeInstCombine(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeIPO(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeInstrumentation(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeAnalysis(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeIPA(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeCodeGen(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeTarget(LLVMPassRegistryRef R);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
69
thirdparty/clang/include/llvm-c/LinkTimeOptimizer.h
vendored
Normal file
69
thirdparty/clang/include/llvm-c/LinkTimeOptimizer.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
//===-- llvm/LinkTimeOptimizer.h - LTO Public C Interface -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header provides a C API to use the LLVM link time optimization
|
||||
// library. This is intended to be used by linkers which are C-only in
|
||||
// their implementation for performing LTO.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_C_LINKTIMEOPTIMIZER_H
|
||||
#define LLVM_C_LINKTIMEOPTIMIZER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCLinkTimeOptimizer Link Time Optimization
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/// This provides a dummy type for pointers to the LTO object.
|
||||
typedef void* llvm_lto_t;
|
||||
|
||||
/// This provides a C-visible enumerator to manage status codes.
|
||||
/// This should map exactly onto the C++ enumerator LTOStatus.
|
||||
typedef enum llvm_lto_status {
|
||||
LLVM_LTO_UNKNOWN,
|
||||
LLVM_LTO_OPT_SUCCESS,
|
||||
LLVM_LTO_READ_SUCCESS,
|
||||
LLVM_LTO_READ_FAILURE,
|
||||
LLVM_LTO_WRITE_FAILURE,
|
||||
LLVM_LTO_NO_TARGET,
|
||||
LLVM_LTO_NO_WORK,
|
||||
LLVM_LTO_MODULE_MERGE_FAILURE,
|
||||
LLVM_LTO_ASM_FAILURE,
|
||||
|
||||
// Added C-specific error codes
|
||||
LLVM_LTO_NULL_OBJECT
|
||||
} llvm_lto_status_t;
|
||||
|
||||
/// This provides C interface to initialize link time optimizer. This allows
|
||||
/// linker to use dlopen() interface to dynamically load LinkTimeOptimizer.
|
||||
/// extern "C" helps, because dlopen() interface uses name to find the symbol.
|
||||
extern llvm_lto_t llvm_create_optimizer(void);
|
||||
extern void llvm_destroy_optimizer(llvm_lto_t lto);
|
||||
|
||||
extern llvm_lto_status_t llvm_read_object_file
|
||||
(llvm_lto_t lto, const char* input_filename);
|
||||
extern llvm_lto_status_t llvm_optimize_modules
|
||||
(llvm_lto_t lto, const char* output_filename);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
42
thirdparty/clang/include/llvm-c/Linker.h
vendored
Normal file
42
thirdparty/clang/include/llvm-c/Linker.h
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*===-- llvm-c/Linker.h - Module Linker C Interface -------------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This file defines the C interface to the module/file/archive linker. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_LINKER_H
|
||||
#define LLVM_C_LINKER_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum {
|
||||
LLVMLinkerDestroySource = 0, /* Allow source module to be destroyed. */
|
||||
LLVMLinkerPreserveSource = 1 /* Preserve the source module. */
|
||||
} LLVMLinkerMode;
|
||||
|
||||
|
||||
/* Links the source module into the destination module, taking ownership
|
||||
* of the source module away from the caller. Optionally returns a
|
||||
* human-readable description of any errors that occurred in linking.
|
||||
* OutMessage must be disposed with LLVMDisposeMessage. The return value
|
||||
* is true if an error occurred, false otherwise. */
|
||||
LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
|
||||
LLVMLinkerMode Mode, char **OutMessage);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
149
thirdparty/clang/include/llvm-c/Object.h
vendored
Normal file
149
thirdparty/clang/include/llvm-c/Object.h
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
/*===-- llvm-c/Object.h - Object Lib C Iface --------------------*- C++ -*-===*/
|
||||
/* */
|
||||
/* The LLVM Compiler Infrastructure */
|
||||
/* */
|
||||
/* This file is distributed under the University of Illinois Open Source */
|
||||
/* License. See LICENSE.TXT for details. */
|
||||
/* */
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
/* */
|
||||
/* This header declares the C interface to libLLVMObject.a, which */
|
||||
/* implements object file reading and writing. */
|
||||
/* */
|
||||
/* Many exotic languages can interoperate with C code but have a harder time */
|
||||
/* with C++ due to name mangling. So in addition to C, this interface enables */
|
||||
/* tools written in such languages. */
|
||||
/* */
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_OBJECT_H
|
||||
#define LLVM_C_OBJECT_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm/Config/llvm-config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCObject Object file reading and writing
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
// Opaque type wrappers
|
||||
typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef;
|
||||
typedef struct LLVMOpaqueSectionIterator *LLVMSectionIteratorRef;
|
||||
typedef struct LLVMOpaqueSymbolIterator *LLVMSymbolIteratorRef;
|
||||
typedef struct LLVMOpaqueRelocationIterator *LLVMRelocationIteratorRef;
|
||||
|
||||
// ObjectFile creation
|
||||
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf);
|
||||
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile);
|
||||
|
||||
// ObjectFile Section iterators
|
||||
LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile);
|
||||
void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI);
|
||||
LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile,
|
||||
LLVMSectionIteratorRef SI);
|
||||
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI);
|
||||
void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect,
|
||||
LLVMSymbolIteratorRef Sym);
|
||||
|
||||
// ObjectFile Symbol iterators
|
||||
LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef ObjectFile);
|
||||
void LLVMDisposeSymbolIterator(LLVMSymbolIteratorRef SI);
|
||||
LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef ObjectFile,
|
||||
LLVMSymbolIteratorRef SI);
|
||||
void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI);
|
||||
|
||||
// SectionRef accessors
|
||||
const char *LLVMGetSectionName(LLVMSectionIteratorRef SI);
|
||||
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI);
|
||||
const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI);
|
||||
uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI);
|
||||
LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI,
|
||||
LLVMSymbolIteratorRef Sym);
|
||||
|
||||
// Section Relocation iterators
|
||||
LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section);
|
||||
void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef RI);
|
||||
LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section,
|
||||
LLVMRelocationIteratorRef RI);
|
||||
void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef RI);
|
||||
|
||||
|
||||
// SymbolRef accessors
|
||||
const char *LLVMGetSymbolName(LLVMSymbolIteratorRef SI);
|
||||
uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI);
|
||||
uint64_t LLVMGetSymbolFileOffset(LLVMSymbolIteratorRef SI);
|
||||
uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI);
|
||||
|
||||
// RelocationRef accessors
|
||||
uint64_t LLVMGetRelocationAddress(LLVMRelocationIteratorRef RI);
|
||||
uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI);
|
||||
LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI);
|
||||
uint64_t LLVMGetRelocationType(LLVMRelocationIteratorRef RI);
|
||||
// NOTE: Caller takes ownership of returned string of the two
|
||||
// following functions.
|
||||
const char *LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI);
|
||||
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
|
||||
|
||||
263
thirdparty/clang/include/llvm-c/Target.h
vendored
Normal file
263
thirdparty/clang/include/llvm-c/Target.h
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
/*===-- llvm-c/Target.h - Target Lib C Iface --------------------*- C++ -*-===*/
|
||||
/* */
|
||||
/* The LLVM Compiler Infrastructure */
|
||||
/* */
|
||||
/* This file is distributed under the University of Illinois Open Source */
|
||||
/* License. See LICENSE.TXT for details. */
|
||||
/* */
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
/* */
|
||||
/* This header declares the C interface to libLLVMTarget.a, which */
|
||||
/* implements target information. */
|
||||
/* */
|
||||
/* Many exotic languages can interoperate with C code but have a harder time */
|
||||
/* with C++ due to name mangling. So in addition to C, this interface enables */
|
||||
/* tools written in such languages. */
|
||||
/* */
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TARGET_H
|
||||
#define LLVM_C_TARGET_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm/Config/llvm-config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTarget Target information
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum LLVMByteOrdering { LLVMBigEndian, LLVMLittleEndian };
|
||||
|
||||
typedef struct LLVMOpaqueTargetData *LLVMTargetDataRef;
|
||||
typedef struct LLVMOpaqueTargetLibraryInfotData *LLVMTargetLibraryInfoRef;
|
||||
typedef struct LLVMStructLayout *LLVMStructLayoutRef;
|
||||
|
||||
/* Declare all of the target-initialization functions that are available. */
|
||||
#define LLVM_TARGET(TargetName) \
|
||||
void LLVMInitialize##TargetName##TargetInfo(void);
|
||||
#include "llvm/Config/Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
|
||||
#define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target(void);
|
||||
#include "llvm/Config/Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
|
||||
#define LLVM_TARGET(TargetName) \
|
||||
void LLVMInitialize##TargetName##TargetMC(void);
|
||||
#include "llvm/Config/Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
|
||||
/* Declare all of the available assembly printer initialization functions. */
|
||||
#define LLVM_ASM_PRINTER(TargetName) \
|
||||
void LLVMInitialize##TargetName##AsmPrinter(void);
|
||||
#include "llvm/Config/AsmPrinters.def"
|
||||
#undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */
|
||||
|
||||
/* Declare all of the available assembly parser initialization functions. */
|
||||
#define LLVM_ASM_PARSER(TargetName) \
|
||||
void LLVMInitialize##TargetName##AsmParser(void);
|
||||
#include "llvm/Config/AsmParsers.def"
|
||||
#undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */
|
||||
|
||||
/* Declare all of the available disassembler initialization functions. */
|
||||
#define LLVM_DISASSEMBLER(TargetName) \
|
||||
void LLVMInitialize##TargetName##Disassembler(void);
|
||||
#include "llvm/Config/Disassemblers.def"
|
||||
#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */
|
||||
|
||||
/** LLVMInitializeAllTargetInfos - The main program should call this function if
|
||||
it wants access to all available targets that LLVM is configured to
|
||||
support. */
|
||||
static inline void LLVMInitializeAllTargetInfos(void) {
|
||||
#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo();
|
||||
#include "llvm/Config/Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
/** LLVMInitializeAllTargets - The main program should call this function if it
|
||||
wants to link in all available targets that LLVM is configured to
|
||||
support. */
|
||||
static inline void LLVMInitializeAllTargets(void) {
|
||||
#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target();
|
||||
#include "llvm/Config/Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
/** LLVMInitializeAllTargetMCs - The main program should call this function if
|
||||
it wants access to all available target MC that LLVM is configured to
|
||||
support. */
|
||||
static inline void LLVMInitializeAllTargetMCs(void) {
|
||||
#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetMC();
|
||||
#include "llvm/Config/Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
/** LLVMInitializeAllAsmPrinters - The main program should call this function if
|
||||
it wants all asm printers that LLVM is configured to support, to make them
|
||||
available via the TargetRegistry. */
|
||||
static inline void LLVMInitializeAllAsmPrinters(void) {
|
||||
#define LLVM_ASM_PRINTER(TargetName) LLVMInitialize##TargetName##AsmPrinter();
|
||||
#include "llvm/Config/AsmPrinters.def"
|
||||
#undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
/** LLVMInitializeAllAsmParsers - The main program should call this function if
|
||||
it wants all asm parsers that LLVM is configured to support, to make them
|
||||
available via the TargetRegistry. */
|
||||
static inline void LLVMInitializeAllAsmParsers(void) {
|
||||
#define LLVM_ASM_PARSER(TargetName) LLVMInitialize##TargetName##AsmParser();
|
||||
#include "llvm/Config/AsmParsers.def"
|
||||
#undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
/** LLVMInitializeAllDisassemblers - The main program should call this function
|
||||
if it wants all disassemblers that LLVM is configured to support, to make
|
||||
them available via the TargetRegistry. */
|
||||
static inline void LLVMInitializeAllDisassemblers(void) {
|
||||
#define LLVM_DISASSEMBLER(TargetName) \
|
||||
LLVMInitialize##TargetName##Disassembler();
|
||||
#include "llvm/Config/Disassemblers.def"
|
||||
#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
/** LLVMInitializeNativeTarget - The main program should call this function to
|
||||
initialize the native target corresponding to the host. This is useful
|
||||
for JIT applications to ensure that the target gets linked in correctly. */
|
||||
static inline LLVMBool LLVMInitializeNativeTarget(void) {
|
||||
/* If we have a native target, initialize it to ensure it is linked in. */
|
||||
#ifdef LLVM_NATIVE_TARGET
|
||||
LLVM_NATIVE_TARGETINFO();
|
||||
LLVM_NATIVE_TARGET();
|
||||
LLVM_NATIVE_TARGETMC();
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*===-- Target Data -------------------------------------------------------===*/
|
||||
|
||||
/** Creates target data from a target layout string.
|
||||
See the constructor llvm::DataLayout::DataLayout. */
|
||||
LLVMTargetDataRef LLVMCreateTargetData(const char *StringRep);
|
||||
|
||||
/** Adds target data information to a pass manager. This does not take ownership
|
||||
of the target data.
|
||||
See the method llvm::PassManagerBase::add. */
|
||||
void LLVMAddTargetData(LLVMTargetDataRef, LLVMPassManagerRef);
|
||||
|
||||
/** Adds target library information to a pass manager. This does not take
|
||||
ownership of the target library info.
|
||||
See the method llvm::PassManagerBase::add. */
|
||||
void LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef, LLVMPassManagerRef);
|
||||
|
||||
/** Converts target data to a target layout string. The string must be disposed
|
||||
with LLVMDisposeMessage.
|
||||
See the constructor llvm::DataLayout::DataLayout. */
|
||||
char *LLVMCopyStringRepOfTargetData(LLVMTargetDataRef);
|
||||
|
||||
/** Returns the byte order of a target, either LLVMBigEndian or
|
||||
LLVMLittleEndian.
|
||||
See the method llvm::DataLayout::isLittleEndian. */
|
||||
enum LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef);
|
||||
|
||||
/** Returns the pointer size in bytes for a target.
|
||||
See the method llvm::DataLayout::getPointerSize. */
|
||||
unsigned LLVMPointerSize(LLVMTargetDataRef);
|
||||
|
||||
/** Returns the pointer size in bytes for a target for a specified
|
||||
address space.
|
||||
See the method llvm::DataLayout::getPointerSize. */
|
||||
unsigned LLVMPointerSizeForAS(LLVMTargetDataRef, unsigned AS);
|
||||
|
||||
/** Returns the integer type that is the same size as a pointer on a target.
|
||||
See the method llvm::DataLayout::getIntPtrType. */
|
||||
LLVMTypeRef LLVMIntPtrType(LLVMTargetDataRef);
|
||||
|
||||
/** Returns the integer type that is the same size as a pointer on a target.
|
||||
This version allows the address space to be specified.
|
||||
See the method llvm::DataLayout::getIntPtrType. */
|
||||
LLVMTypeRef LLVMIntPtrTypeForAS(LLVMTargetDataRef, unsigned AS);
|
||||
|
||||
/** Computes the size of a type in bytes for a target.
|
||||
See the method llvm::DataLayout::getTypeSizeInBits. */
|
||||
unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef, LLVMTypeRef);
|
||||
|
||||
/** Computes the storage size of a type in bytes for a target.
|
||||
See the method llvm::DataLayout::getTypeStoreSize. */
|
||||
unsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef, LLVMTypeRef);
|
||||
|
||||
/** Computes the ABI size of a type in bytes for a target.
|
||||
See the method llvm::DataLayout::getTypeAllocSize. */
|
||||
unsigned long long LLVMABISizeOfType(LLVMTargetDataRef, LLVMTypeRef);
|
||||
|
||||
/** Computes the ABI alignment of a type in bytes for a target.
|
||||
See the method llvm::DataLayout::getTypeABISize. */
|
||||
unsigned LLVMABIAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
|
||||
|
||||
/** Computes the call frame alignment of a type in bytes for a target.
|
||||
See the method llvm::DataLayout::getTypeABISize. */
|
||||
unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
|
||||
|
||||
/** Computes the preferred alignment of a type in bytes for a target.
|
||||
See the method llvm::DataLayout::getTypeABISize. */
|
||||
unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
|
||||
|
||||
/** Computes the preferred alignment of a global variable in bytes for a target.
|
||||
See the method llvm::DataLayout::getPreferredAlignment. */
|
||||
unsigned LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef,
|
||||
LLVMValueRef GlobalVar);
|
||||
|
||||
/** Computes the structure element that contains the byte offset for a target.
|
||||
See the method llvm::StructLayout::getElementContainingOffset. */
|
||||
unsigned LLVMElementAtOffset(LLVMTargetDataRef, LLVMTypeRef StructTy,
|
||||
unsigned long long Offset);
|
||||
|
||||
/** Computes the byte offset of the indexed struct element for a target.
|
||||
See the method llvm::StructLayout::getElementContainingOffset. */
|
||||
unsigned long long LLVMOffsetOfElement(LLVMTargetDataRef, LLVMTypeRef StructTy,
|
||||
unsigned Element);
|
||||
|
||||
/** Deallocates a TargetData.
|
||||
See the destructor llvm::DataLayout::~DataLayout. */
|
||||
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
|
||||
146
thirdparty/clang/include/llvm-c/TargetMachine.h
vendored
Normal file
146
thirdparty/clang/include/llvm-c/TargetMachine.h
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
/*===-- llvm-c/TargetMachine.h - Target Machine Library C Interface - C++ -*-=*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to the Target and TargetMachine *|
|
||||
|* classes, which can be used to generate assembly or object files. *|
|
||||
|* *|
|
||||
|* Many exotic languages can interoperate with C code but have a harder time *|
|
||||
|* with C++ due to name mangling. So in addition to C, this interface enables *|
|
||||
|* tools written in such languages. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TARGETMACHINE_H
|
||||
#define LLVM_C_TARGETMACHINE_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm-c/Target.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef struct LLVMTargetMachine *LLVMTargetMachineRef;
|
||||
typedef struct LLVMTarget *LLVMTargetRef;
|
||||
|
||||
typedef enum {
|
||||
LLVMCodeGenLevelNone,
|
||||
LLVMCodeGenLevelLess,
|
||||
LLVMCodeGenLevelDefault,
|
||||
LLVMCodeGenLevelAggressive
|
||||
} LLVMCodeGenOptLevel;
|
||||
|
||||
typedef enum {
|
||||
LLVMRelocDefault,
|
||||
LLVMRelocStatic,
|
||||
LLVMRelocPIC,
|
||||
LLVMRelocDynamicNoPic
|
||||
} LLVMRelocMode;
|
||||
|
||||
typedef enum {
|
||||
LLVMCodeModelDefault,
|
||||
LLVMCodeModelJITDefault,
|
||||
LLVMCodeModelSmall,
|
||||
LLVMCodeModelKernel,
|
||||
LLVMCodeModelMedium,
|
||||
LLVMCodeModelLarge
|
||||
} LLVMCodeModel;
|
||||
|
||||
typedef enum {
|
||||
LLVMAssemblyFile,
|
||||
LLVMObjectFile
|
||||
} LLVMCodeGenFileType;
|
||||
|
||||
/** Returns the first llvm::Target in the registered targets list. */
|
||||
LLVMTargetRef LLVMGetFirstTarget();
|
||||
/** Returns the next llvm::Target given a previous one (or null if there's none) */
|
||||
LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T);
|
||||
|
||||
/*===-- Target ------------------------------------------------------------===*/
|
||||
/** Returns the name of a target. See llvm::Target::getName */
|
||||
const char *LLVMGetTargetName(LLVMTargetRef T);
|
||||
|
||||
/** Returns the description of a target. See llvm::Target::getDescription */
|
||||
const char *LLVMGetTargetDescription(LLVMTargetRef T);
|
||||
|
||||
/** Returns if the target has a JIT */
|
||||
LLVMBool LLVMTargetHasJIT(LLVMTargetRef T);
|
||||
|
||||
/** Returns if the target has a TargetMachine associated */
|
||||
LLVMBool LLVMTargetHasTargetMachine(LLVMTargetRef T);
|
||||
|
||||
/** Returns if the target as an ASM backend (required for emitting output) */
|
||||
LLVMBool LLVMTargetHasAsmBackend(LLVMTargetRef T);
|
||||
|
||||
/*===-- Target Machine ----------------------------------------------------===*/
|
||||
/** Creates a new llvm::TargetMachine. See llvm::Target::createTargetMachine */
|
||||
LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T, char *Triple,
|
||||
char *CPU, char *Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc,
|
||||
LLVMCodeModel CodeModel);
|
||||
|
||||
/** Dispose the LLVMTargetMachineRef instance generated by
|
||||
LLVMCreateTargetMachine. */
|
||||
void LLVMDisposeTargetMachine(LLVMTargetMachineRef T);
|
||||
|
||||
/** Returns the Target used in a TargetMachine */
|
||||
LLVMTargetRef LLVMGetTargetMachineTarget(LLVMTargetMachineRef T);
|
||||
|
||||
/** Returns the triple used creating this target machine. See
|
||||
llvm::TargetMachine::getTriple. The result needs to be disposed with
|
||||
LLVMDisposeMessage. */
|
||||
char *LLVMGetTargetMachineTriple(LLVMTargetMachineRef T);
|
||||
|
||||
/** Returns the cpu used creating this target machine. See
|
||||
llvm::TargetMachine::getCPU. The result needs to be disposed with
|
||||
LLVMDisposeMessage. */
|
||||
char *LLVMGetTargetMachineCPU(LLVMTargetMachineRef T);
|
||||
|
||||
/** Returns the feature string used creating this target machine. See
|
||||
llvm::TargetMachine::getFeatureString. The result needs to be disposed with
|
||||
LLVMDisposeMessage. */
|
||||
char *LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T);
|
||||
|
||||
/** Returns the llvm::DataLayout used for this llvm:TargetMachine. */
|
||||
LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T);
|
||||
|
||||
/** Emits an asm or object file for the given module to the filename. This
|
||||
wraps several c++ only classes (among them a file stream). Returns any
|
||||
error in ErrorMessage. Use LLVMDisposeMessage to dispose the message. */
|
||||
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
|
||||
81
thirdparty/clang/include/llvm-c/Transforms/IPO.h
vendored
Normal file
81
thirdparty/clang/include/llvm-c/Transforms/IPO.h
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/*===-- IPO.h - Interprocedural Transformations C Interface -----*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMIPO.a, which implements *|
|
||||
|* various interprocedural transformations of the LLVM IR. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_IPO_H
|
||||
#define LLVM_C_TRANSFORMS_IPO_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsIPO Interprocedural transformations
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createArgumentPromotionPass function. */
|
||||
void LLVMAddArgumentPromotionPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createConstantMergePass function. */
|
||||
void LLVMAddConstantMergePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createDeadArgEliminationPass function. */
|
||||
void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createFunctionAttrsPass function. */
|
||||
void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createFunctionInliningPass function. */
|
||||
void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createAlwaysInlinerPass function. */
|
||||
void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createGlobalDCEPass function. */
|
||||
void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createGlobalOptimizerPass function. */
|
||||
void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createIPConstantPropagationPass function. */
|
||||
void LLVMAddIPConstantPropagationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createPruneEHPass function. */
|
||||
void LLVMAddPruneEHPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createIPSCCPPass function. */
|
||||
void LLVMAddIPSCCPPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createInternalizePass function. */
|
||||
void LLVMAddInternalizePass(LLVMPassManagerRef, unsigned AllButMain);
|
||||
|
||||
/** See llvm::createStripDeadPrototypesPass function. */
|
||||
void LLVMAddStripDeadPrototypesPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createStripSymbolsPass function. */
|
||||
void LLVMAddStripSymbolsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
||||
#endif
|
||||
101
thirdparty/clang/include/llvm-c/Transforms/PassManagerBuilder.h
vendored
Normal file
101
thirdparty/clang/include/llvm-c/Transforms/PassManagerBuilder.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/*===-- llvm-c/Transform/PassManagerBuilder.h - PMB C Interface ---*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to the PassManagerBuilder class. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_PASSMANAGERBUILDER_H
|
||||
#define LLVM_C_TRANSFORMS_PASSMANAGERBUILDER_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
|
||||
typedef struct LLVMOpaquePassManagerBuilder *LLVMPassManagerBuilderRef;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsPassManagerBuilder Pass manager builder
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::PassManagerBuilder. */
|
||||
LLVMPassManagerBuilderRef LLVMPassManagerBuilderCreate(void);
|
||||
void LLVMPassManagerBuilderDispose(LLVMPassManagerBuilderRef PMB);
|
||||
|
||||
/** See llvm::PassManagerBuilder::OptLevel. */
|
||||
void
|
||||
LLVMPassManagerBuilderSetOptLevel(LLVMPassManagerBuilderRef PMB,
|
||||
unsigned OptLevel);
|
||||
|
||||
/** See llvm::PassManagerBuilder::SizeLevel. */
|
||||
void
|
||||
LLVMPassManagerBuilderSetSizeLevel(LLVMPassManagerBuilderRef PMB,
|
||||
unsigned SizeLevel);
|
||||
|
||||
/** See llvm::PassManagerBuilder::DisableUnitAtATime. */
|
||||
void
|
||||
LLVMPassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMBool Value);
|
||||
|
||||
/** See llvm::PassManagerBuilder::DisableUnrollLoops. */
|
||||
void
|
||||
LLVMPassManagerBuilderSetDisableUnrollLoops(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMBool Value);
|
||||
|
||||
/** See llvm::PassManagerBuilder::DisableSimplifyLibCalls */
|
||||
void
|
||||
LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMBool Value);
|
||||
|
||||
/** See llvm::PassManagerBuilder::Inliner. */
|
||||
void
|
||||
LLVMPassManagerBuilderUseInlinerWithThreshold(LLVMPassManagerBuilderRef PMB,
|
||||
unsigned Threshold);
|
||||
|
||||
/** See llvm::PassManagerBuilder::populateFunctionPassManager. */
|
||||
void
|
||||
LLVMPassManagerBuilderPopulateFunctionPassManager(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::PassManagerBuilder::populateModulePassManager. */
|
||||
void
|
||||
LLVMPassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::PassManagerBuilder::populateLTOPassManager. */
|
||||
void LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMPassManagerRef PM,
|
||||
LLVMBool Internalize,
|
||||
LLVMBool RunInliner);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#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
|
||||
134
thirdparty/clang/include/llvm-c/Transforms/Scalar.h
vendored
Normal file
134
thirdparty/clang/include/llvm-c/Transforms/Scalar.h
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMScalarOpts.a, which *|
|
||||
|* implements various scalar transformations of the LLVM IR. *|
|
||||
|* *|
|
||||
|* Many exotic languages can interoperate with C code but have a harder time *|
|
||||
|* with C++ due to name mangling. So in addition to C, this interface enables *|
|
||||
|* tools written in such languages. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_SCALAR_H
|
||||
#define LLVM_C_TRANSFORMS_SCALAR_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsScalar Scalar transformations
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createAggressiveDCEPass function. */
|
||||
void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createCFGSimplificationPass function. */
|
||||
void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createDeadStoreEliminationPass function. */
|
||||
void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createGVNPass function. */
|
||||
void LLVMAddGVNPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createIndVarSimplifyPass function. */
|
||||
void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createInstructionCombiningPass function. */
|
||||
void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createJumpThreadingPass function. */
|
||||
void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLICMPass function. */
|
||||
void LLVMAddLICMPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopDeletionPass function. */
|
||||
void LLVMAddLoopDeletionPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopIdiomPass function */
|
||||
void LLVMAddLoopIdiomPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopRotatePass function. */
|
||||
void LLVMAddLoopRotatePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopUnrollPass function. */
|
||||
void LLVMAddLoopUnrollPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopUnswitchPass function. */
|
||||
void LLVMAddLoopUnswitchPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createMemCpyOptPass function. */
|
||||
void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createPromoteMemoryToRegisterPass function. */
|
||||
void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createReassociatePass function. */
|
||||
void LLVMAddReassociatePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createSCCPPass function. */
|
||||
void LLVMAddSCCPPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createScalarReplAggregatesPass function. */
|
||||
void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createScalarReplAggregatesPass function. */
|
||||
void LLVMAddScalarReplAggregatesPassSSA(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createScalarReplAggregatesPass function. */
|
||||
void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM,
|
||||
int Threshold);
|
||||
|
||||
/** See llvm::createSimplifyLibCallsPass function. */
|
||||
void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createTailCallEliminationPass function. */
|
||||
void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createConstantPropagationPass function. */
|
||||
void LLVMAddConstantPropagationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::demotePromoteMemoryToRegisterPass function. */
|
||||
void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createVerifierPass function. */
|
||||
void LLVMAddVerifierPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createCorrelatedValuePropagationPass function */
|
||||
void LLVMAddCorrelatedValuePropagationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createEarlyCSEPass function */
|
||||
void LLVMAddEarlyCSEPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLowerExpectIntrinsicPass function */
|
||||
void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createTypeBasedAliasAnalysisPass function */
|
||||
void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createBasicAliasAnalysisPass function */
|
||||
void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
||||
#endif
|
||||
54
thirdparty/clang/include/llvm-c/Transforms/Vectorize.h
vendored
Normal file
54
thirdparty/clang/include/llvm-c/Transforms/Vectorize.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*===---------------------------Vectorize.h --------------------- -*- C -*-===*\
|
||||
|*===----------- Vectorization Transformation Library C Interface ---------===*|
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMVectorize.a, which *|
|
||||
|* implements various vectorization transformations of the LLVM IR. *|
|
||||
|* *|
|
||||
|* Many exotic languages can interoperate with C code but have a harder time *|
|
||||
|* with C++ due to name mangling. So in addition to C, this interface enables *|
|
||||
|* tools written in such languages. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_VECTORIZE_H
|
||||
#define LLVM_C_TRANSFORMS_VECTORIZE_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsVectorize Vectorization transformations
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createBBVectorizePass function. */
|
||||
void LLVMAddBBVectorizePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopVectorizePass function. */
|
||||
void LLVMAddLoopVectorizePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createSLPVectorizerPass function. */
|
||||
void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
||||
#endif
|
||||
|
||||
309
thirdparty/clang/include/llvm-c/lto.h
vendored
Normal file
309
thirdparty/clang/include/llvm-c/lto.h
vendored
Normal file
@@ -0,0 +1,309 @@
|
||||
/*===-- llvm-c/lto.h - LTO Public C Interface ---------------------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header provides public interface to an abstract link time optimization*|
|
||||
|* library. LLVM provides an implementation of this interface for use with *|
|
||||
|* llvm bitcode files. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_LTO_H
|
||||
#define LLVM_C_LTO_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCLTO LTO
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define LTO_API_VERSION 4
|
||||
|
||||
typedef enum {
|
||||
LTO_SYMBOL_ALIGNMENT_MASK = 0x0000001F, /* log2 of alignment */
|
||||
LTO_SYMBOL_PERMISSIONS_MASK = 0x000000E0,
|
||||
LTO_SYMBOL_PERMISSIONS_CODE = 0x000000A0,
|
||||
LTO_SYMBOL_PERMISSIONS_DATA = 0x000000C0,
|
||||
LTO_SYMBOL_PERMISSIONS_RODATA = 0x00000080,
|
||||
LTO_SYMBOL_DEFINITION_MASK = 0x00000700,
|
||||
LTO_SYMBOL_DEFINITION_REGULAR = 0x00000100,
|
||||
LTO_SYMBOL_DEFINITION_TENTATIVE = 0x00000200,
|
||||
LTO_SYMBOL_DEFINITION_WEAK = 0x00000300,
|
||||
LTO_SYMBOL_DEFINITION_UNDEFINED = 0x00000400,
|
||||
LTO_SYMBOL_DEFINITION_WEAKUNDEF = 0x00000500,
|
||||
LTO_SYMBOL_SCOPE_MASK = 0x00003800,
|
||||
LTO_SYMBOL_SCOPE_INTERNAL = 0x00000800,
|
||||
LTO_SYMBOL_SCOPE_HIDDEN = 0x00001000,
|
||||
LTO_SYMBOL_SCOPE_PROTECTED = 0x00002000,
|
||||
LTO_SYMBOL_SCOPE_DEFAULT = 0x00001800,
|
||||
LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN = 0x00002800
|
||||
} lto_symbol_attributes;
|
||||
|
||||
typedef enum {
|
||||
LTO_DEBUG_MODEL_NONE = 0,
|
||||
LTO_DEBUG_MODEL_DWARF = 1
|
||||
} lto_debug_model;
|
||||
|
||||
typedef enum {
|
||||
LTO_CODEGEN_PIC_MODEL_STATIC = 0,
|
||||
LTO_CODEGEN_PIC_MODEL_DYNAMIC = 1,
|
||||
LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC = 2
|
||||
} lto_codegen_model;
|
||||
|
||||
|
||||
/** opaque reference to a loaded object module */
|
||||
typedef struct LTOModule* lto_module_t;
|
||||
|
||||
/** opaque reference to a code generator */
|
||||
typedef struct LTOCodeGenerator* lto_code_gen_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns a printable string.
|
||||
*/
|
||||
extern const char*
|
||||
lto_get_version(void);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the last error string or NULL if last operation was successful.
|
||||
*/
|
||||
extern const char*
|
||||
lto_get_error_message(void);
|
||||
|
||||
/**
|
||||
* Checks if a file is a loadable object file.
|
||||
*/
|
||||
extern bool
|
||||
lto_module_is_object_file(const char* path);
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a file is a loadable object compiled for requested target.
|
||||
*/
|
||||
extern bool
|
||||
lto_module_is_object_file_for_target(const char* path,
|
||||
const char* target_triple_prefix);
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a buffer is a loadable object file.
|
||||
*/
|
||||
extern bool
|
||||
lto_module_is_object_file_in_memory(const void* mem, size_t length);
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a buffer is a loadable object compiled for requested target.
|
||||
*/
|
||||
extern bool
|
||||
lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length,
|
||||
const char* target_triple_prefix);
|
||||
|
||||
|
||||
/**
|
||||
* Loads an object file from disk.
|
||||
* Returns NULL on error (check lto_get_error_message() for details).
|
||||
*/
|
||||
extern lto_module_t
|
||||
lto_module_create(const char* path);
|
||||
|
||||
|
||||
/**
|
||||
* Loads an object file from memory.
|
||||
* Returns NULL on error (check lto_get_error_message() for details).
|
||||
*/
|
||||
extern lto_module_t
|
||||
lto_module_create_from_memory(const void* mem, size_t length);
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*/
|
||||
extern lto_module_t
|
||||
lto_module_create_from_fd(int fd, const char *path, size_t file_size);
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*/
|
||||
extern lto_module_t
|
||||
lto_module_create_from_fd_at_offset(int fd, const char *path, size_t file_size,
|
||||
size_t map_size, off_t offset);
|
||||
|
||||
|
||||
/**
|
||||
* Frees all memory internally allocated by the module.
|
||||
* Upon return the lto_module_t is no longer valid.
|
||||
*/
|
||||
extern void
|
||||
lto_module_dispose(lto_module_t mod);
|
||||
|
||||
|
||||
/**
|
||||
* Returns triple string which the object module was compiled under.
|
||||
*/
|
||||
extern const char*
|
||||
lto_module_get_target_triple(lto_module_t mod);
|
||||
|
||||
/**
|
||||
* Sets triple string with which the object will be codegened.
|
||||
*/
|
||||
extern void
|
||||
lto_module_set_target_triple(lto_module_t mod, const char *triple);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of symbols in the object module.
|
||||
*/
|
||||
extern unsigned int
|
||||
lto_module_get_num_symbols(lto_module_t mod);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the name of the ith symbol in the object module.
|
||||
*/
|
||||
extern const char*
|
||||
lto_module_get_symbol_name(lto_module_t mod, unsigned int index);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the attributes of the ith symbol in the object module.
|
||||
*/
|
||||
extern lto_symbol_attributes
|
||||
lto_module_get_symbol_attribute(lto_module_t mod, unsigned int index);
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a code generator.
|
||||
* Returns NULL on error (check lto_get_error_message() for details).
|
||||
*/
|
||||
extern lto_code_gen_t
|
||||
lto_codegen_create(void);
|
||||
|
||||
|
||||
/**
|
||||
* Frees all code generator and all memory it internally allocated.
|
||||
* Upon return the lto_code_gen_t is no longer valid.
|
||||
*/
|
||||
extern void
|
||||
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).
|
||||
*/
|
||||
extern bool
|
||||
lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets if debug info should be generated.
|
||||
* Returns true on error (check lto_get_error_message() for details).
|
||||
*/
|
||||
extern bool
|
||||
lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);
|
||||
|
||||
|
||||
/**
|
||||
* Sets which PIC code model to generated.
|
||||
* Returns true on error (check lto_get_error_message() for details).
|
||||
*/
|
||||
extern bool
|
||||
lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the cpu to generate code for.
|
||||
*/
|
||||
extern void
|
||||
lto_codegen_set_cpu(lto_code_gen_t cg, const char *cpu);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the location of the assembler tool to run. If not set, libLTO
|
||||
* will use gcc to invoke the assembler.
|
||||
*/
|
||||
extern void
|
||||
lto_codegen_set_assembler_path(lto_code_gen_t cg, const char* path);
|
||||
|
||||
/**
|
||||
* Sets extra arguments that libLTO should pass to the assembler.
|
||||
*/
|
||||
extern void
|
||||
lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
|
||||
int nargs);
|
||||
|
||||
/**
|
||||
* Adds to a list of all global symbols that must exist in the final
|
||||
* generated code. If a function is not listed, it might be
|
||||
* inlined into every usage and optimized away.
|
||||
*/
|
||||
extern void
|
||||
lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const char* symbol);
|
||||
|
||||
/**
|
||||
* Writes a new object file at the specified path that contains the
|
||||
* merged contents of all modules added so far.
|
||||
* Returns true on error (check lto_get_error_message() for details).
|
||||
*/
|
||||
extern bool
|
||||
lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);
|
||||
|
||||
/**
|
||||
* Generates code for all added modules into one native object file.
|
||||
* On success returns a pointer to a generated mach-o/ELF buffer and
|
||||
* length set to the buffer size. The buffer is owned by the
|
||||
* lto_code_gen_t and will be freed when lto_codegen_dispose()
|
||||
* is called, or lto_codegen_compile() is called again.
|
||||
* On failure, returns NULL (check lto_get_error_message() for details).
|
||||
*/
|
||||
extern const void*
|
||||
lto_codegen_compile(lto_code_gen_t cg, size_t* length);
|
||||
|
||||
/**
|
||||
* Generates code for all added modules into one native object file.
|
||||
* The name of the file is written to name. Returns true on error.
|
||||
*/
|
||||
extern bool
|
||||
lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name);
|
||||
|
||||
|
||||
/**
|
||||
* Sets options to help debug codegen bugs.
|
||||
*/
|
||||
extern void
|
||||
lto_codegen_debug_options(lto_code_gen_t cg, const char *);
|
||||
|
||||
/**
|
||||
* Initializes LLVM disassemblers.
|
||||
* FIXME: This doesn't really belong here.
|
||||
*/
|
||||
extern void
|
||||
lto_initialize_disassembler(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user