Go to the documentation of this file.
35 return reinterpret_cast<Target*
>(
P);
59 [&](
const Target &
T) {
return T.getName() == NameRef; });
64 char **ErrorMessage) {
71 *ErrorMessage = strdup(
Error.c_str());
84 return unwrap(
T)->getShortDescription();
92 return unwrap(
T)->hasTargetMachine();
96 return unwrap(
T)->hasMCAsmBackend();
100 const char *
Triple,
const char *CPU,
const char *Features,
103 std::optional<Reloc::Model>
RM;
159 std::string StringRep =
unwrap(
T)->getTargetTriple().str();
160 return strdup(StringRep.c_str());
164 std::string StringRep = std::string(
unwrap(
T)->getTargetCPU());
165 return strdup(StringRep.c_str());
169 std::string StringRep = std::string(
unwrap(
T)->getTargetFeatureString());
170 return strdup(StringRep.c_str());
175 unwrap(
T)->Options.MCOptions.AsmVerbose = VerboseAsm;
185 char **ErrorMessage) {
204 if (
TM->addPassesToEmitFile(
pass, OS,
nullptr, ft)) {
205 error =
"TargetMachine can't emit a file of this type";
206 *ErrorMessage = strdup(
error.c_str());
217 const char *Filename,
219 char **ErrorMessage) {
223 *ErrorMessage = strdup(EC.message().c_str());
261 for (
const auto &[Feature, IsEnabled] : HostFeatures)
264 return strdup(Features.
getString().c_str());
LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T, const char *Triple, const char *CPU, const char *Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, LLVMCodeModel CodeModel)
Creates a new llvm::TargetMachine.
static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M, raw_pwrite_stream &OS, LLVMCodeGenFileType codegen, char **ErrorMessage)
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
A parsed version of the target data layout string in and methods for querying it.
static std::unique_ptr< TargetMachine > createTargetMachine(Function *F, CodeGenOpt::Level OptLevel)
Create the TargetMachine object to query the backend for optimization preferences.
const char * LLVMGetTargetName(LLVMTargetRef T)
Returns the name of a target.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T, LLVMBool VerboseAsm)
Set the target machine's ASM verbosity.
Target - Wrapper for Target specific information.
void AddFeature(StringRef String, bool Enable=true)
Adds Features.
const char * LLVMGetTargetDescription(LLVMTargetRef T)
Returns the description of a target.
Since we know that Vector is byte aligned and we know the element offset of we should change the load into a lve *x instead of doing a load store lve *x sequence Implement passing vectors by value into calls and receiving them as arguments GCC apparently tries to codegen
LLVMTargetRef LLVMGetTargetMachineTarget(LLVMTargetMachineRef T)
Returns the Target used in a TargetMachine.
Triple - Helper class for working with autoconf configuration names.
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.
bool getHostCPUFeatures(StringMap< bool, MallocAllocator > &Features)
getHostCPUFeatures - Get the LLVM names for the host CPU features.
const_iterator end(StringRef path)
Get end iterator over path.
const_iterator begin(StringRef path, Style style=Style::native)
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 LLVMGetTargetFromName(const char *Name)
Finds the target corresponding to the given name and stores it in T.
LLVMTargetRef LLVMGetFirstTarget()
Returns the first llvm::Target in the registered targets list.
struct LLVMOpaqueTargetData * LLVMTargetDataRef
LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M, const char *Filename, LLVMCodeGenFileType codegen, char **ErrorMessage)
Emits an asm or object file for the given module to the filename.
LLVMBool LLVMTargetHasTargetMachine(LLVMTargetRef T)
Returns if the target has a TargetMachine associated.
struct LLVMTarget * LLVMTargetRef
static iterator_range< iterator > targets()
LLVMTargetDataRef LLVMCreateTargetDataLayout(LLVMTargetMachineRef T)
Create a DataLayout based on the targetMachine.
Manages the enabling and disabling of subtarget specific features.
modulo schedule Modulo Schedule test pass
Attribute unwrap(LLVMAttributeRef Attr)
LLVMBool LLVMTargetHasJIT(LLVMTargetRef T)
Returns if the target has a JIT.
ImmutablePass * createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA)
Create an analysis pass wrapper around a TTI object.
std::string getString() const
Returns features as a string.
An abstract base class for streams implementations that also support a pwrite operation.
std::string normalize() const
Return the normalized form of this triple's string.
void setDataLayout(StringRef Desc)
Set the data layout.
char * LLVMGetTargetMachineCPU(LLVMTargetMachineRef T)
Returns the cpu used creating this target machine.
Primary interface to the complete machine description for the target machine.
A Module instance is used to store all the information related to an LLVM module.
struct LLVMOpaquePassManager * LLVMPassManagerRef
LLVMAttributeRef wrap(Attribute Attr)
char * LLVMGetHostCPUFeatures(void)
Get the host CPU's features as a string.
std::string getDefaultTargetTriple()
getDefaultTargetTriple() - Return the default target triple the compiler has been configured to produ...
void LLVMDisposeTargetMachine(LLVMTargetMachineRef T)
Dispose the LLVMTargetMachineRef instance generated by LLVMCreateTargetMachine.
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
StringRef - Represent a constant reference to a string, i.e.
StringRef str() const
Return a StringRef for the vector contents.
@ LLVMCodeGenLevelAggressive
char * LLVMGetTargetMachineTriple(LLVMTargetMachineRef T)
Returns the triple used creating this target machine.
A raw_ostream that writes to a file descriptor.
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
char * LLVMNormalizeTargetTriple(const char *triple)
Normalize a target triple.
char * LLVMGetDefaultTargetTriple(void)
Get a triple for the host machine as a string.
Lightweight error class with error context and mandatory checking.
PassManager manages ModulePassManagers.
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
LLVMBool LLVMGetTargetFromTriple(const char *TripleStr, LLVMTargetRef *T, char **ErrorMessage)
Finds the target corresponding to the given triple and stores it in T.
char * LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T)
Returns the feature string used creating this target machine.
LLVMBool LLVMTargetHasAsmBackend(LLVMTargetRef T)
Returns if the target as an ASM backend (required for emitting output)
char * LLVMGetHostCPUName(void)
Get the host CPU as a string.
LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T)
Returns the next llvm::Target given a previous one (or null if there's none)
StringRef getHostCPUName()
getHostCPUName - Get the LLVM name for the host CPU.
A raw_ostream that writes to an SmallVector or SmallString.
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
const char LLVMTargetMachineRef TM
Level
Code generation optimization level.
void LLVMAddAnalysisPasses(LLVMTargetMachineRef T, LLVMPassManagerRef PM)
Adds the target-specific analysis passes to the pass manager.
struct LLVMOpaqueTargetMachine * LLVMTargetMachineRef
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.