39 return reinterpret_cast<Target*
>(
P);
63 auto I = std::find_if(
70 char **ErrorMessage) {
77 *ErrorMessage = strdup(Error.c_str());
86 return unwrap(T)->getName();
90 return unwrap(T)->getShortDescription();
94 return unwrap(T)->hasJIT();
98 return unwrap(T)->hasTargetMachine();
102 return unwrap(T)->hasMCAsmBackend();
144 return wrap(
unwrap(T)->createTargetMachine(Triple, CPU, Features, opt, RM,
159 std::string StringRep =
unwrap(T)->getTargetTriple().str();
160 return strdup(StringRep.c_str());
164 std::string StringRep =
unwrap(T)->getTargetCPU();
165 return strdup(StringRep.c_str());
169 std::string StringRep =
unwrap(T)->getTargetFeatureString();
170 return strdup(StringRep.c_str());
179 unwrap(T)->Options.MCOptions.AsmVerbose = VerboseAsm;
185 char **ErrorMessage) {
196 error =
"No DataLayout in TargetMachine";
197 *ErrorMessage = strdup(error.c_str());
212 error =
"TargetMachine can't emit a file of this type";
213 *ErrorMessage = strdup(error.c_str());
228 *ErrorMessage = strdup(EC.message().c_str());
A parsed version of the target data layout string in and methods for querying it. ...
const_iterator end(StringRef path)
Get end iterator over path.
size_t size() const
size - Get the string size.
const char * getName() const
getName - Get the target name.
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
A Module instance is used to store all the information related to an LLVM module. ...
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
Used to pass regions of memory through LLVM interfaces.
char * LLVMGetDefaultTargetTriple(void)
Get a triple for the host machine as a string.
std::string getDefaultTargetTriple()
getDefaultTargetTriple() - Return the default target triple the compiler has been configured to produ...
ImmutablePass * createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA)
Create an analysis pass wrapper around a TTI object.
const FeatureBitset Features
void setDataLayout(StringRef Desc)
Set the data layout.
A raw_ostream that writes to an SmallVector or SmallString.
const_iterator begin(StringRef path)
Get begin iterator over path.
static const Target * lookupTarget(const std::string &Triple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.
LLVMTargetRef LLVMGetTargetMachineTarget(LLVMTargetMachineRef T)
Returns the Target used in a TargetMachine.
LLVMBool LLVMTargetHasAsmBackend(LLVMTargetRef T)
Returns if the target as an ASM backend (required for emitting output)
struct LLVMOpaqueTargetMachine * LLVMTargetMachineRef
void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T, LLVMBool VerboseAsm)
Set the target machine's ASM verbosity.
const char * LLVMGetTargetName(LLVMTargetRef T)
Returns the name of a target.
LLVMTargetDataRef wrap(const DataLayout *P)
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
char * LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T)
Returns the feature string used creating this target machine.
LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T)
Deprecated: use LLVMGetDataLayout(LLVMModuleRef M) instead.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
static std::error_code error(DiagnosticHandlerFunction DiagnosticHandler, std::error_code EC, const Twine &Message)
static iterator_range< iterator > targets()
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.
PassManager manages ModulePassManagers.
DataLayout * unwrap(LLVMTargetDataRef P)
LLVMBool LLVMGetTargetFromTriple(const char *TripleStr, LLVMTargetRef *T, char **ErrorMessage)
Finds the target corresponding to the given triple and stores it in T.
void LLVMDisposeTargetMachine(LLVMTargetMachineRef T)
Dispose the LLVMTargetMachineRef instance generated by LLVMCreateTargetMachine.
struct LLVMTarget * LLVMTargetRef
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.
static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M, raw_pwrite_stream &OS, LLVMCodeGenFileType codegen, char **ErrorMessage)
Two Address instruction pass
const char * LLVMGetTargetDescription(LLVMTargetRef T)
Returns the description of a target.
LLVMBool LLVMTargetHasTargetMachine(LLVMTargetRef T)
Returns if the target has a TargetMachine associated.
LLVMTargetRef LLVMGetFirstTarget()
Returns the first llvm::Target in the registered targets list.
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
Triple - Helper class for working with autoconf configuration names.
char * LLVMGetTargetMachineTriple(LLVMTargetMachineRef T)
Returns the triple used creating this target machine.
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T)
Returns the next llvm::Target given a previous one (or null if there's none)
const DataLayout * getDataLayout() const
Deprecated in 3.7, will be removed in 3.8.
Module.h This file contains the declarations for the Module class.
char * LLVMGetTargetMachineCPU(LLVMTargetMachineRef T)
Returns the cpu used creating this target machine.
Target - Wrapper for Target specific information.
virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &, CodeGenFileType, bool=true, AnalysisID=nullptr, AnalysisID=nullptr, AnalysisID=nullptr, MachineFunctionInitializer *=nullptr)
Add passes to the specified pass manager to get the specified file emitted.
StringRef str()
Flushes the stream contents to the target vector and return a StringRef for the vector contents...
struct LLVMOpaquePassManager * LLVMPassManagerRef
A raw_ostream that writes to a file descriptor.
LLVMBool LLVMTargetHasJIT(LLVMTargetRef T)
Returns if the target has a JIT.
LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T, const char *Triple, const char *CPU, const char *Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, LLVMCodeModel CodeModel)
Creates a new llvm::TargetMachine.
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
An abstract base class for streams implementations that also support a pwrite operation.
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
void LLVMAddAnalysisPasses(LLVMTargetMachineRef T, LLVMPassManagerRef PM)
Adds the target-specific analysis passes to the pass manager.
LLVMTargetRef LLVMGetTargetFromName(const char *Name)
Finds the target corresponding to the given name and stores it in T.
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit...
struct LLVMOpaqueTargetData * LLVMTargetDataRef