LLVM API Documentation
#include "llvm-c/TargetMachine.h"#include "llvm-c/Core.h"#include "llvm-c/Target.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/Module.h"#include "llvm/PassManager.h"#include "llvm/Support/CodeGen.h"#include "llvm/Support/FormattedStream.h"#include "llvm/Support/TargetRegistry.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Target/TargetMachine.h"#include <cassert>#include <cstdlib>#include <cstring>
Go to the source code of this file.
| LLVMTargetMachineRef LLVMCreateTargetMachine | ( | LLVMTargetRef | T, |
| char * | Triple, | ||
| char * | CPU, | ||
| char * | Features, | ||
| LLVMCodeGenOptLevel | Level, | ||
| LLVMRelocMode | Reloc, | ||
| LLVMCodeModel | CodeModel | ||
| ) |
Creates a new llvm::TargetMachine. See llvm::Target::createTargetMachine
Definition at line 90 of file TargetMachineC.cpp.
References llvm::CodeGenOpt::Aggressive, llvm::Reloc::Default, llvm::CodeGenOpt::Default, llvm::Reloc::DynamicNoPIC, llvm::CodeGenOpt::Less, LLVMCodeGenLevelAggressive, LLVMCodeGenLevelLess, LLVMCodeGenLevelNone, LLVMRelocDynamicNoPic, LLVMRelocPIC, LLVMRelocStatic, llvm::CodeGenOpt::None, llvm::Reloc::PIC_, llvm::Reloc::Static, llvm::unwrap(), and llvm::wrap().
| void LLVMDisposeTargetMachine | ( | LLVMTargetMachineRef | T | ) |
Dispose the LLVMTargetMachineRef instance generated by LLVMCreateTargetMachine.
Definition at line 133 of file TargetMachineC.cpp.
References llvm::unwrap().
| LLVMTargetRef LLVMGetFirstTarget | ( | ) |
Returns the first llvm::Target in the registered targets list.
Definition at line 62 of file TargetMachineC.cpp.
References llvm::TargetRegistry::begin(), 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 66 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 74 of file TargetMachineC.cpp.
References llvm::unwrap().
| 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 147 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 157 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 152 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 137 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 142 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 70 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 86 of file TargetMachineC.cpp.
References llvm::unwrap().
| LLVMBool LLVMTargetHasJIT | ( | LLVMTargetRef | T | ) |
Returns if the target has a JIT
Definition at line 78 of file TargetMachineC.cpp.
References llvm::unwrap().
| LLVMBool LLVMTargetHasTargetMachine | ( | LLVMTargetRef | T | ) |
Returns if the target has a TargetMachine associated
Definition at line 82 of file TargetMachineC.cpp.
References llvm::unwrap().
| static LLVMBool LLVMTargetMachineEmit | ( | LLVMTargetMachineRef | T, |
| LLVMModuleRef | M, | ||
| formatted_raw_ostream & | OS, | ||
| LLVMCodeGenFileType | codegen, | ||
| char ** | ErrorMessage | ||
| ) | [static] |
Definition at line 161 of file TargetMachineC.cpp.
References llvm::PassManager::add(), llvm::TargetMachine::addPassesToEmitFile(), llvm::TargetMachine::CGFT_AssemblyFile, llvm::TargetMachine::CGFT_ObjectFile, llvm::raw_ostream::flush(), llvm::TargetMachine::getDataLayout(), LLVMAssemblyFile, pass, llvm::PassManager::run(), llvm::LibFunc::strdup, and llvm::unwrap().
Referenced by LLVMTargetMachineEmitToFile(), and LLVMTargetMachineEmitToMemoryBuffer().
| 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 200 of file TargetMachineC.cpp.
References llvm::raw_fd_ostream::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 214 of file TargetMachineC.cpp.
References llvm::object::macho::Data, llvm::raw_ostream::flush(), LLVMCreateMemoryBufferWithMemoryRangeCopy(), LLVMTargetMachineEmit(), and llvm::raw_string_ostream::str().
| DataLayout* unwrap | ( | LLVMTargetDataRef | P | ) | [inline] |
Definition at line 31 of file TargetMachineC.cpp.
| TargetLibraryInfo* unwrap | ( | LLVMTargetLibraryInfoRef | P | ) | [inline] |
Definition at line 39 of file TargetMachineC.cpp.
| TargetMachine* unwrap | ( | LLVMTargetMachineRef | P | ) | [inline] |
Definition at line 48 of file TargetMachineC.cpp.
| Target* unwrap | ( | LLVMTargetRef | P | ) | [inline] |
Definition at line 51 of file TargetMachineC.cpp.
| LLVMTargetDataRef wrap | ( | const DataLayout * | P | ) | [inline] |
Definition at line 35 of file TargetMachineC.cpp.
| LLVMTargetLibraryInfoRef wrap | ( | const TargetLibraryInfo * | P | ) | [inline] |
Definition at line 43 of file TargetMachineC.cpp.
References llvm::X.
| LLVMTargetMachineRef wrap | ( | const TargetMachine * | P | ) | [inline] |
Definition at line 54 of file TargetMachineC.cpp.
| LLVMTargetRef wrap | ( | const Target * | P | ) | [inline] |
Definition at line 58 of file TargetMachineC.cpp.