X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm-c%2FTargetMachine.h;h=e1594113949cdb39577c141ad82ea40671a4b45e;hp=e6f477af78786c7c0d5face14ef6f77a941b4372;hb=fa74752298602e0b74fb60ce3f0e76d0c461d3d8;hpb=7d2166a643a7c16b9b0c87441b662f66e79b131f diff --git a/include/llvm-c/TargetMachine.h b/include/llvm-c/TargetMachine.h index e6f477af787..e1594113949 100644 --- a/include/llvm-c/TargetMachine.h +++ b/include/llvm-c/TargetMachine.h @@ -25,7 +25,7 @@ #ifdef __cplusplus extern "C" { #endif -typedef struct LLVMTargetMachine *LLVMTargetMachineRef; +typedef struct LLVMOpaqueTargetMachine *LLVMTargetMachineRef; typedef struct LLVMTarget *LLVMTargetRef; typedef enum { @@ -57,11 +57,21 @@ typedef enum { } LLVMCodeGenFileType; /** Returns the first llvm::Target in the registered targets list. */ -LLVMTargetRef LLVMGetFirstTarget(); +LLVMTargetRef LLVMGetFirstTarget(void); /** Returns the next llvm::Target given a previous one (or null if there's none) */ LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T); /*===-- Target ------------------------------------------------------------===*/ +/** Finds the target corresponding to the given name and stores it in \p T. + Returns 0 on success. */ +LLVMTargetRef LLVMGetTargetFromName(const char *Name); + +/** Finds the target corresponding to the given triple and stores it in \p T. + Returns 0 on success. Optionally returns any error in ErrorMessage. + Use LLVMDisposeMessage to dispose the message. */ +LLVMBool LLVMGetTargetFromTriple(const char* Triple, LLVMTargetRef *T, + char **ErrorMessage); + /** Returns the name of a target. See llvm::Target::getName */ const char *LLVMGetTargetName(LLVMTargetRef T); @@ -79,9 +89,9 @@ 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); +LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T, + const char *Triple, const char *CPU, const char *Features, + LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, LLVMCodeModel CodeModel); /** Dispose the LLVMTargetMachineRef instance generated by LLVMCreateTargetMachine. */ @@ -108,38 +118,27 @@ char *LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T); /** Returns the llvm::DataLayout used for this llvm:TargetMachine. */ LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T); +/** Set the target machine's ASM verbosity. */ +void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T, + LLVMBool VerboseAsm); + /** 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); - +/*===-- Triple ------------------------------------------------------------===*/ +/** Get a triple for the host machine as a string. The result needs to be + disposed with LLVMDisposeMessage. */ +char* LLVMGetDefaultTargetTriple(void); #ifdef __cplusplus } #endif -#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) -namespace llvm { - class TargetMachine; - class Target; - - inline TargetMachine *unwrap(LLVMTargetMachineRef P) { - return reinterpret_cast(P); - } - inline Target *unwrap(LLVMTargetRef P) { - return reinterpret_cast(P); - } - inline LLVMTargetMachineRef wrap(const TargetMachine *P) { - return reinterpret_cast( - const_cast(P)); - } - inline LLVMTargetRef wrap(const Target * P) { - return reinterpret_cast(const_cast(P)); - } -} -#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */ - #endif