31 const Target *TheTarget =
nullptr;
32 if (!ArchName.empty()) {
37 Error =
"error: invalid target '" + ArchName +
"'.\n";
50 std::string TempError;
53 Error =
": error: unable to get target for '" 55 +
"', see --version and --triple.\n";
67 Error =
"Unable to find target for this triple (no targets are registered)";
71 auto ArchMatch = [&](
const Target &
T) {
return T.ArchMatchFn(Arch); };
75 Error =
"No available targets are compatible with triple \"" + TT +
"\"";
81 Error = std::string(
"Cannot choose between targets \"") +
I->Name +
82 "\" and \"" + J->Name +
"\"";
90 const char *ShortDesc,
91 const char *BackendName,
94 assert(Name && ShortDesc && ArchMatchFn &&
95 "Missing required target information!");
107 T.ShortDesc = ShortDesc;
108 T.BackendName = BackendName;
109 T.ArchMatchFn = ArchMatchFn;
114 const std::pair<StringRef, const Target *> *RHS) {
115 return LHS->first.compare(RHS->first);
119 std::vector<std::pair<StringRef, const Target*> > Targets;
122 Targets.push_back(std::make_pair(
T.getName(), &
T));
123 Width =
std::max(Width, Targets.back().first.size());
127 OS <<
" Registered Targets:\n";
128 for (
unsigned i = 0, e = Targets.size(); i != e; ++i) {
129 OS <<
" " << Targets[i].first;
130 OS.
indent(Width - Targets[i].
first.size()) <<
" - " 131 << Targets[i].
second->getShortDescription() <<
'\n';
const_iterator end(StringRef path)
Get end iterator over path.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
This class represents lattice values for constants.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
static const Target * lookupTarget(const std::string &Triple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.
const char * getName() const
getName - Get the target name.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
static iterator_range< iterator > targets()
void array_pod_sort(IteratorTy Start, IteratorTy End)
array_pod_sort - This sorts an array with the specified start and end extent.
The instances of the Type class are immutable: once they are created, they are never changed...
bool(*)(Triple::ArchType Arch) ArchMatchFnTy
static void RegisterTarget(Target &T, const char *Name, const char *ShortDesc, const char *BackendName, Target::ArchMatchFnTy ArchMatchFn, bool HasJIT=false)
RegisterTarget - Register the given target.
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
static Target * FirstTarget
Triple - Helper class for working with autoconf configuration names.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
static int TargetArraySortFn(const std::pair< StringRef, const Target *> *LHS, const std::pair< StringRef, const Target *> *RHS)
static ArchType getArchTypeForLLVMName(StringRef Str)
getArchTypeForLLVMName - The canonical type for the given LLVM architecture name (e.g., "x86").
static void printRegisteredTargetsForVersion(raw_ostream &OS)
printRegisteredTargetsForVersion - Print the registered targets appropriately for inclusion in a tool...
A range adaptor for a pair of iterators.
Target - Wrapper for Target specific information.
const std::string & getTriple() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
This class implements an extremely fast bulk output stream that can only output to a stream...
void setArch(ArchType Kind)
setArch - Set the architecture (first) component of the triple to a known type.