Go to the documentation of this file.
30 const Target *TheTarget =
nullptr;
31 if (!ArchName.empty()) {
33 [&](
const Target &
T) {
return ArchName ==
T.getName(); });
36 Error =
"invalid target '" + ArchName +
"'.\n";
49 std::string TempError;
52 Error =
"unable to get target for '"
54 +
"', see --version and --triple.\n";
66 Error =
"Unable to find target for this triple (no targets are registered)";
70 auto ArchMatch = [&](
const Target &
T) {
return T.ArchMatchFn(Arch); };
74 Error =
"No available targets are compatible with triple \"" + TT +
"\"";
80 Error = std::string(
"Cannot choose between targets \"") +
I->Name +
81 "\" and \"" + J->Name +
"\"";
89 const char *ShortDesc,
90 const char *BackendName,
93 assert(Name && ShortDesc && ArchMatchFn &&
94 "Missing required target information!");
106 T.ShortDesc = ShortDesc;
107 T.BackendName = BackendName;
108 T.ArchMatchFn = ArchMatchFn;
113 const std::pair<StringRef, const Target *> *
RHS) {
114 return LHS->first.compare(
RHS->first);
118 std::vector<std::pair<StringRef, const Target*> > Targets;
121 Targets.push_back(std::make_pair(
T.getName(), &
T));
127 OS <<
" Registered Targets:\n";
128 for (
const auto &
Target : Targets) {
129 OS <<
" " <<
Target.first;
void array_pod_sort(IteratorTy Start, IteratorTy End)
array_pod_sort - This sorts an array with the specified start and end extent.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Target - Wrapper for Target specific information.
static ArchType getArchTypeForLLVMName(StringRef Str)
The canonical type for the given LLVM architecture name (e.g., "x86").
Triple - Helper class for working with autoconf configuration names.
The instances of the Type class are immutable: once they are created, they are never changed.
const_iterator end(StringRef path)
Get end iterator over path.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
static const Target * lookupTarget(const std::string &Triple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.
static iterator_range< iterator > targets()
This class implements an extremely fast bulk output stream that can only output to a stream.
ArchType getArch() const
Get the parsed architecture type of this triple.
const std::string & getTriple() const
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.
void setArch(ArchType Kind, SubArchType SubArch=NoSubArch)
Set the architecture (first) component of the triple to a known type.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static Target * FirstTarget
bool(*)(Triple::ArchType Arch) ArchMatchFnTy
static void printRegisteredTargetsForVersion(raw_ostream &OS)
printRegisteredTargetsForVersion - Print the registered targets appropriately for inclusion in a tool...
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Lightweight error class with error context and mandatory checking.
const char * getShortDescription() const
getShortDescription - Get a short description of the target.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
A range adaptor for a pair of iterators.
static int TargetArraySortFn(const std::pair< StringRef, const Target * > *LHS, const std::pair< StringRef, const Target * > *RHS)