LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Typedefs | Enumerations | Functions
c/TargetMachine.h File Reference
#include "llvm-c/Core.h"
#include "llvm-c/Target.h"
Include dependency graph for c/TargetMachine.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct
LLVMOpaqueTargetMachine * 
LLVMTargetMachineRef
 
typedef struct LLVMTarget * LLVMTargetRef
 

Enumerations

enum  LLVMCodeGenOptLevel { LLVMCodeGenLevelNone, LLVMCodeGenLevelLess, LLVMCodeGenLevelDefault, LLVMCodeGenLevelAggressive }
 
enum  LLVMRelocMode { LLVMRelocDefault, LLVMRelocStatic, LLVMRelocPIC, LLVMRelocDynamicNoPic }
 
enum  LLVMCodeModel {
  LLVMCodeModelDefault, LLVMCodeModelJITDefault, LLVMCodeModelSmall, LLVMCodeModelKernel,
  LLVMCodeModelMedium, LLVMCodeModelLarge
}
 
enum  LLVMCodeGenFileType { LLVMAssemblyFile, LLVMObjectFile }
 

Functions

LLVMTargetRef LLVMGetFirstTarget (void)
 
LLVMTargetRef LLVMGetNextTarget (LLVMTargetRef T)
 
LLVMTargetRef LLVMGetTargetFromName (const char *Name)
 
LLVMBool LLVMGetTargetFromTriple (const char *Triple, LLVMTargetRef *T, char **ErrorMessage)
 
const char * LLVMGetTargetName (LLVMTargetRef T)
 
const char * LLVMGetTargetDescription (LLVMTargetRef T)
 
LLVMBool LLVMTargetHasJIT (LLVMTargetRef T)
 
LLVMBool LLVMTargetHasTargetMachine (LLVMTargetRef T)
 
LLVMBool LLVMTargetHasAsmBackend (LLVMTargetRef T)
 
LLVMTargetMachineRef LLVMCreateTargetMachine (LLVMTargetRef T, const char *Triple, const char *CPU, const char *Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, LLVMCodeModel CodeModel)
 
void LLVMDisposeTargetMachine (LLVMTargetMachineRef T)
 
LLVMTargetRef LLVMGetTargetMachineTarget (LLVMTargetMachineRef T)
 
char * LLVMGetTargetMachineTriple (LLVMTargetMachineRef T)
 
char * LLVMGetTargetMachineCPU (LLVMTargetMachineRef T)
 
char * LLVMGetTargetMachineFeatureString (LLVMTargetMachineRef T)
 
LLVMTargetDataRef LLVMGetTargetMachineData (LLVMTargetMachineRef T)
 
void LLVMSetTargetMachineAsmVerbosity (LLVMTargetMachineRef T, LLVMBool VerboseAsm)
 
LLVMBool LLVMTargetMachineEmitToFile (LLVMTargetMachineRef T, LLVMModuleRef M, char *Filename, LLVMCodeGenFileType codegen, char **ErrorMessage)
 
LLVMBool LLVMTargetMachineEmitToMemoryBuffer (LLVMTargetMachineRef T, LLVMModuleRef M, LLVMCodeGenFileType codegen, char **ErrorMessage, LLVMMemoryBufferRef *OutMemBuf)
 
char * LLVMGetDefaultTargetTriple (void)
 

Typedef Documentation

typedef struct LLVMOpaqueTargetMachine* LLVMTargetMachineRef

Definition at line 28 of file c/TargetMachine.h.

typedef struct LLVMTarget* LLVMTargetRef

Definition at line 29 of file c/TargetMachine.h.

Enumeration Type Documentation

Enumerator
LLVMAssemblyFile 
LLVMObjectFile 

Definition at line 54 of file c/TargetMachine.h.

Enumerator
LLVMCodeGenLevelNone 
LLVMCodeGenLevelLess 
LLVMCodeGenLevelDefault 
LLVMCodeGenLevelAggressive 

Definition at line 31 of file c/TargetMachine.h.

Enumerator
LLVMCodeModelDefault 
LLVMCodeModelJITDefault 
LLVMCodeModelSmall 
LLVMCodeModelKernel 
LLVMCodeModelMedium 
LLVMCodeModelLarge 

Definition at line 45 of file c/TargetMachine.h.

Enumerator
LLVMRelocDefault 
LLVMRelocStatic 
LLVMRelocPIC 
LLVMRelocDynamicNoPic 

Definition at line 38 of file c/TargetMachine.h.

Function Documentation

LLVMTargetMachineRef LLVMCreateTargetMachine ( LLVMTargetRef  T,
const char *  Triple,
const char *  CPU,
const char *  Features,
LLVMCodeGenOptLevel  Level,
LLVMRelocMode  Reloc,
LLVMCodeModel  CodeModel 
)
void LLVMDisposeTargetMachine ( LLVMTargetMachineRef  T)

Dispose the LLVMTargetMachineRef instance generated by LLVMCreateTargetMachine.

Definition at line 166 of file TargetMachineC.cpp.

References llvm::unwrap().

char* LLVMGetDefaultTargetTriple ( void  )

Get a triple for the host machine as a string. The result needs to be disposed with LLVMDisposeMessage.

Definition at line 267 of file TargetMachineC.cpp.

References llvm::c_str(), llvm::sys::getDefaultTargetTriple(), and llvm::LibFunc::strdup.

LLVMTargetRef LLVMGetFirstTarget ( void  )

Returns the first llvm::Target in the registered targets list.

Definition at line 63 of file TargetMachineC.cpp.

References llvm::TargetRegistry::begin(), llvm::TargetRegistry::end(), and llvm::wrap().

LLVMTargetRef LLVMGetNextTarget ( LLVMTargetRef  T)

Returns the next llvm::Target given a previous one (or null if there's none)

Definition at line 71 of file TargetMachineC.cpp.

References llvm::unwrap(), and llvm::wrap().

const char* LLVMGetTargetDescription ( LLVMTargetRef  T)

Returns the description of a target. See llvm::Target::getDescription

Definition at line 106 of file TargetMachineC.cpp.

References llvm::unwrap().

LLVMTargetRef LLVMGetTargetFromName ( const char *  Name)

Finds the target corresponding to the given name and stores it in T. Returns 0 on success.

Definition at line 75 of file TargetMachineC.cpp.

References llvm::TargetRegistry::begin(), llvm::TargetRegistry::end(), llvm::ARM_PROC::IE, IT(), and llvm::wrap().

LLVMBool LLVMGetTargetFromTriple ( const char *  Triple,
LLVMTargetRef T,
char **  ErrorMessage 
)

Finds the target corresponding to the given triple and stores it in T. Returns 0 on success. Optionally returns any error in ErrorMessage. Use LLVMDisposeMessage to dispose the message.

Definition at line 86 of file TargetMachineC.cpp.

References llvm::lltok::Error, llvm::TargetRegistry::lookupTarget(), llvm::LibFunc::strdup, and llvm::wrap().

char* LLVMGetTargetMachineCPU ( LLVMTargetMachineRef  T)

Returns the cpu used creating this target machine. See llvm::TargetMachine::getCPU. The result needs to be disposed with LLVMDisposeMessage.

Definition at line 180 of file TargetMachineC.cpp.

References llvm::LibFunc::strdup, and llvm::unwrap().

LLVMTargetDataRef LLVMGetTargetMachineData ( LLVMTargetMachineRef  T)

Returns the llvm::DataLayout used for this llvm:TargetMachine.

Definition at line 190 of file TargetMachineC.cpp.

References llvm::unwrap(), and llvm::wrap().

char* LLVMGetTargetMachineFeatureString ( LLVMTargetMachineRef  T)

Returns the feature string used creating this target machine. See llvm::TargetMachine::getFeatureString. The result needs to be disposed with LLVMDisposeMessage.

Definition at line 185 of file TargetMachineC.cpp.

References llvm::LibFunc::strdup, and llvm::unwrap().

LLVMTargetRef LLVMGetTargetMachineTarget ( LLVMTargetMachineRef  T)

Returns the Target used in a TargetMachine

Definition at line 170 of file TargetMachineC.cpp.

References llvm::unwrap(), and llvm::wrap().

char* LLVMGetTargetMachineTriple ( LLVMTargetMachineRef  T)

Returns the triple used creating this target machine. See llvm::TargetMachine::getTriple. The result needs to be disposed with LLVMDisposeMessage.

Definition at line 175 of file TargetMachineC.cpp.

References llvm::LibFunc::strdup, and llvm::unwrap().

const char* LLVMGetTargetName ( LLVMTargetRef  T)

Returns the name of a target. See llvm::Target::getName

Definition at line 102 of file TargetMachineC.cpp.

References llvm::unwrap().

void LLVMSetTargetMachineAsmVerbosity ( LLVMTargetMachineRef  T,
LLVMBool  VerboseAsm 
)

Set the target machine's ASM verbosity.

Definition at line 194 of file TargetMachineC.cpp.

References llvm::unwrap().

LLVMBool LLVMTargetHasAsmBackend ( LLVMTargetRef  T)

Returns if the target as an ASM backend (required for emitting output)

Definition at line 118 of file TargetMachineC.cpp.

References llvm::unwrap().

LLVMBool LLVMTargetHasJIT ( LLVMTargetRef  T)

Returns if the target has a JIT

Definition at line 110 of file TargetMachineC.cpp.

References llvm::unwrap().

LLVMBool LLVMTargetHasTargetMachine ( LLVMTargetRef  T)

Returns if the target has a TargetMachine associated

Definition at line 114 of file TargetMachineC.cpp.

References llvm::unwrap().

LLVMBool LLVMTargetMachineEmitToFile ( LLVMTargetMachineRef  T,
LLVMModuleRef  M,
char *  Filename,
LLVMCodeGenFileType  codegen,
char **  ErrorMessage 
)

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.

Definition at line 238 of file TargetMachineC.cpp.

References llvm::sys::fs::F_Binary, llvm::raw_ostream::flush(), LLVMTargetMachineEmit(), and llvm::LibFunc::strdup.

LLVMBool LLVMTargetMachineEmitToMemoryBuffer ( LLVMTargetMachineRef  T,
LLVMModuleRef  M,
LLVMCodeGenFileType  codegen,
char **  ErrorMessage,
LLVMMemoryBufferRef OutMemBuf 
)

Compile the LLVM IR stored in M and store the result in OutMemBuf.

Definition at line 252 of file TargetMachineC.cpp.

References llvm::raw_ostream::flush(), LLVMCreateMemoryBufferWithMemoryRangeCopy(), LLVMTargetMachineEmit(), and llvm::raw_string_ostream::str().