LLVM
8.0.1
|
#include "llvm-c/Core.h"
#include "llvm-c/Target.h"
#include "llvm-c/TargetMachine.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/CodeGenCWrappers.h"
#include "llvm/Target/TargetMachine.h"
#include <cassert>
#include <cstdlib>
#include <cstring>
Go to the source code of this file.
void LLVMAddAnalysisPasses | ( | LLVMTargetMachineRef | T, |
LLVMPassManagerRef | PM | ||
) |
Adds the target-specific analysis passes to the pass manager.
Definition at line 269 of file TargetMachineC.cpp.
References llvm::createTargetTransformInfoWrapperPass(), and llvm::unwrap().
LLVMTargetDataRef LLVMCreateTargetDataLayout | ( | LLVMTargetMachineRef | T | ) |
Create a DataLayout based on the targetMachine.
Definition at line 182 of file TargetMachineC.cpp.
References llvm::unwrap(), and llvm::wrap().
LLVMTargetMachineRef LLVMCreateTargetMachine | ( | LLVMTargetRef | T, |
const char * | Triple, | ||
const char * | CPU, | ||
const char * | Features, | ||
LLVMCodeGenOptLevel | Level, | ||
LLVMRelocMode | Reloc, | ||
LLVMCodeModel | CodeModel | ||
) |
Creates a new llvm::TargetMachine.
See llvm::Target::createTargetMachine
Definition at line 103 of file TargetMachineC.cpp.
References llvm::CodeGenOpt::Aggressive, llvm::CodeGenOpt::Default, llvm::Reloc::DynamicNoPIC, llvm::EngineKind::JIT, llvm::CodeGenOpt::Less, LLVMCodeGenLevelAggressive, LLVMCodeGenLevelLess, LLVMCodeGenLevelNone, LLVMRelocDynamicNoPic, LLVMRelocPIC, LLVMRelocROPI, LLVMRelocROPI_RWPI, LLVMRelocRWPI, LLVMRelocStatic, llvm::CodeGenOpt::None, opt, llvm::Reloc::PIC_, llvm::NVPTX::PTXCvtMode::RM, llvm::Reloc::ROPI, llvm::Reloc::ROPI_RWPI, llvm::Reloc::RWPI, llvm::Reloc::Static, llvm::unwrap(), and llvm::wrap().
void LLVMDisposeTargetMachine | ( | LLVMTargetMachineRef | T | ) |
Dispose the LLVMTargetMachineRef instance generated by LLVMCreateTargetMachine.
Definition at line 155 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 246 of file TargetMachineC.cpp.
References llvm::c_str(), and llvm::sys::getDefaultTargetTriple().
LLVMTargetRef LLVMGetFirstTarget | ( | void | ) |
Returns the first llvm::Target in the registered targets list.
Definition at line 48 of file TargetMachineC.cpp.
References llvm::sys::path::begin(), llvm::sys::path::end(), llvm::TargetRegistry::targets(), and llvm::wrap().
char* LLVMGetHostCPUFeatures | ( | void | ) |
Get the host CPU's features as a string.
The result needs to be disposed with LLVMDisposeMessage.
Definition at line 258 of file TargetMachineC.cpp.
References llvm::SubtargetFeatures::AddFeature(), F(), Features, llvm::sys::getHostCPUFeatures(), and llvm::SubtargetFeatures::getString().
char* LLVMGetHostCPUName | ( | void | ) |
Get the host CPU as a string.
The result needs to be disposed with LLVMDisposeMessage.
Definition at line 254 of file TargetMachineC.cpp.
References llvm::sys::getHostCPUName().
LLVMTargetRef LLVMGetNextTarget | ( | LLVMTargetRef | T | ) |
Returns the next llvm::Target given a previous one (or null if there's none)
Definition at line 56 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 87 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 60 of file TargetMachineC.cpp.
References llvm::find_if(), llvm::Target::getName(), I, Name, llvm::TargetRegistry::targets(), 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 67 of file TargetMachineC.cpp.
References llvm::TargetRegistry::lookupTarget(), 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 167 of file TargetMachineC.cpp.
References llvm::unwrap().
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 172 of file TargetMachineC.cpp.
References llvm::unwrap().
LLVMTargetRef LLVMGetTargetMachineTarget | ( | LLVMTargetMachineRef | T | ) |
Returns the Target used in a TargetMachine.
Definition at line 157 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 162 of file TargetMachineC.cpp.
References llvm::unwrap().
const char* LLVMGetTargetName | ( | LLVMTargetRef | T | ) |
Returns the name of a target.
Definition at line 83 of file TargetMachineC.cpp.
References llvm::unwrap().
Normalize a target triple.
The result needs to be disposed with LLVMDisposeMessage.
Definition at line 250 of file TargetMachineC.cpp.
References llvm::c_str(), and llvm::Triple::normalize().
void LLVMSetTargetMachineAsmVerbosity | ( | LLVMTargetMachineRef | T, |
LLVMBool | VerboseAsm | ||
) |
Set the target machine's ASM verbosity.
Definition at line 177 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 99 of file TargetMachineC.cpp.
References llvm::unwrap().
LLVMBool LLVMTargetHasJIT | ( | LLVMTargetRef | T | ) |
Returns if the target has a JIT.
Definition at line 91 of file TargetMachineC.cpp.
References llvm::unwrap().
LLVMBool LLVMTargetHasTargetMachine | ( | LLVMTargetRef | T | ) |
Returns if the target has a TargetMachine associated.
Definition at line 95 of file TargetMachineC.cpp.
References llvm::unwrap().
|
static |
Definition at line 186 of file TargetMachineC.cpp.
References llvm::TargetMachine::addPassesToEmitFile(), llvm::TargetMachine::CGFT_AssemblyFile, llvm::TargetMachine::CGFT_ObjectFile, llvm::TargetMachine::createDataLayout(), error, llvm::raw_ostream::flush(), LLVMAssemblyFile, llvm::Mod, pass, llvm::legacy::PassManager::run(), llvm::Module::setDataLayout(), llvm::SystemZISD::TM, 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 220 of file TargetMachineC.cpp.
References llvm::sys::fs::F_None, llvm::raw_ostream::flush(), and LLVMTargetMachineEmit().
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 233 of file TargetMachineC.cpp.
References llvm::Data, llvm::StringRef::data(), LLVMCreateMemoryBufferWithMemoryRangeCopy(), LLVMTargetMachineEmit(), llvm::StringRef::size(), and llvm::raw_svector_ostream::str().
|
static |
Definition at line 35 of file TargetMachineC.cpp.
References P.
|
static |
Definition at line 38 of file TargetMachineC.cpp.
References P.
|
static |
Definition at line 41 of file TargetMachineC.cpp.
References P.
|
static |
Definition at line 44 of file TargetMachineC.cpp.
References P.