r250678 - Recommit "Return an ArrayRef instead of having two out parameters of a pointer and length. NFC". Hopefully this time the bots will be happy.
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 18 20:52:27 PDT 2015
Author: ctopper
Date: Sun Oct 18 22:52:27 2015
New Revision: 250678
URL: http://llvm.org/viewvc/llvm-project?rev=250678&view=rev
Log:
Recommit "Return an ArrayRef instead of having two out parameters of a pointer and length. NFC". Hopefully this time the bots will be happy.
Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/TargetInfo.cpp
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=250678&r1=250677&r2=250678&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Sun Oct 18 22:52:27 2015
@@ -930,14 +930,10 @@ protected:
virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const {
return PtrDiffType;
}
- virtual void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const = 0;
- virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const = 0;
- virtual void getGCCAddlRegNames(const AddlRegName *&Addl,
- unsigned &NumAddl) const {
- Addl = nullptr;
- NumAddl = 0;
+ virtual ArrayRef<const char *> getGCCRegNames() const = 0;
+ virtual ArrayRef<GCCRegAlias> getGCCRegAliases() const = 0;
+ virtual ArrayRef<AddlRegName> getGCCAddlRegNames() const {
+ return None;
}
};
Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=250678&r1=250677&r2=250678&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Sun Oct 18 22:52:27 2015
@@ -349,49 +349,41 @@ bool TargetInfo::isValidGCCRegisterName(
if (Name.empty())
return false;
- const char * const *Names;
- unsigned NumNames;
-
// Get rid of any register prefix.
Name = removeGCCRegisterPrefix(Name);
if (Name.empty())
return false;
- getGCCRegNames(Names, NumNames);
+ ArrayRef<const char *> Names = getGCCRegNames();
// If we have a number it maps to an entry in the register name array.
if (isDigit(Name[0])) {
int n;
if (!Name.getAsInteger(0, n))
- return n >= 0 && (unsigned)n < NumNames;
+ return n >= 0 && (unsigned)n < Names.size();
}
// Check register names.
- for (unsigned i = 0; i < NumNames; i++) {
+ for (unsigned i = 0; i < Names.size(); i++) {
if (Name == Names[i])
return true;
}
// Check any additional names that we have.
- const AddlRegName *AddlNames;
- unsigned NumAddlNames;
- getGCCAddlRegNames(AddlNames, NumAddlNames);
- for (unsigned i = 0; i < NumAddlNames; i++)
+ ArrayRef<AddlRegName> AddlNames = getGCCAddlRegNames();
+ for (unsigned i = 0; i < AddlNames.size(); i++)
for (unsigned j = 0; j < llvm::array_lengthof(AddlNames[i].Names); j++) {
if (!AddlNames[i].Names[j])
break;
// Make sure the register that the additional name is for is within
// the bounds of the register names from above.
- if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < NumNames)
+ if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < Names.size())
return true;
}
// Now check aliases.
- const GCCRegAlias *Aliases;
- unsigned NumAliases;
-
- getGCCRegAliases(Aliases, NumAliases);
- for (unsigned i = 0; i < NumAliases; i++) {
+ ArrayRef<GCCRegAlias> Aliases = getGCCRegAliases();
+ for (unsigned i = 0; i < Aliases.size(); i++) {
for (unsigned j = 0 ; j < llvm::array_lengthof(Aliases[i].Aliases); j++) {
if (!Aliases[i].Aliases[j])
break;
@@ -410,41 +402,33 @@ TargetInfo::getNormalizedGCCRegisterName
// Get rid of any register prefix.
Name = removeGCCRegisterPrefix(Name);
- const char * const *Names;
- unsigned NumNames;
-
- getGCCRegNames(Names, NumNames);
+ ArrayRef<const char *> Names = getGCCRegNames();
// First, check if we have a number.
if (isDigit(Name[0])) {
int n;
if (!Name.getAsInteger(0, n)) {
- assert(n >= 0 && (unsigned)n < NumNames &&
+ assert(n >= 0 && (unsigned)n < Names.size() &&
"Out of bounds register number!");
return Names[n];
}
}
// Check any additional names that we have.
- const AddlRegName *AddlNames;
- unsigned NumAddlNames;
- getGCCAddlRegNames(AddlNames, NumAddlNames);
- for (unsigned i = 0; i < NumAddlNames; i++)
+ ArrayRef<AddlRegName> AddlNames = getGCCAddlRegNames();
+ for (unsigned i = 0; i < AddlNames.size(); i++)
for (unsigned j = 0; j < llvm::array_lengthof(AddlNames[i].Names); j++) {
if (!AddlNames[i].Names[j])
break;
// Make sure the register that the additional name is for is within
// the bounds of the register names from above.
- if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < NumNames)
+ if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < Names.size())
return Name;
}
// Now check aliases.
- const GCCRegAlias *Aliases;
- unsigned NumAliases;
-
- getGCCRegAliases(Aliases, NumAliases);
- for (unsigned i = 0; i < NumAliases; i++) {
+ ArrayRef<GCCRegAlias> Aliases = getGCCRegAliases();
+ for (unsigned i = 0; i < Aliases.size(); i++) {
for (unsigned j = 0 ; j < llvm::array_lengthof(Aliases[i].Aliases); j++) {
if (!Aliases[i].Aliases[j])
break;
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=250678&r1=250677&r2=250678&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sun Oct 18 22:52:27 2015
@@ -898,10 +898,8 @@ public:
void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
bool Enabled) const override;
- void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const override;
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override;
+ ArrayRef<const char *> getGCCRegNames() const override;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &Info) const override {
switch (*Name) {
@@ -1388,10 +1386,8 @@ const char * const PPCTargetInfo::GCCReg
"sfp"
};
-void PPCTargetInfo::getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ArrayRef<const char*> PPCTargetInfo::getGCCRegNames() const {
+ return llvm::makeArrayRef(GCCRegNames);
}
const TargetInfo::GCCRegAlias PPCTargetInfo::GCCRegAliases[] = {
@@ -1464,10 +1460,8 @@ const TargetInfo::GCCRegAlias PPCTargetI
{ { "cc" }, "cr0" },
};
-void PPCTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const {
- Aliases = GCCRegAliases;
- NumAliases = llvm::array_lengthof(GCCRegAliases);
+ArrayRef<TargetInfo::GCCRegAlias> PPCTargetInfo::getGCCRegAliases() const {
+ return llvm::makeArrayRef(GCCRegAliases);
}
class PPC32TargetInfo : public PPCTargetInfo {
@@ -1652,13 +1646,10 @@ public:
return Feature == "ptx" || Feature == "nvptx";
}
- void getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const override;
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {
+ ArrayRef<const char *> getGCCRegNames() const override;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
// No aliases.
- Aliases = nullptr;
- NumAliases = 0;
+ return None;
}
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &Info) const override {
@@ -1706,10 +1697,8 @@ const Builtin::Info NVPTXTargetInfo::Bui
const char *const NVPTXTargetInfo::GCCRegNames[] = {"r0"};
-void NVPTXTargetInfo::getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ArrayRef<const char *> NVPTXTargetInfo::getGCCRegNames() const {
+ return llvm::makeArrayRef(GCCRegNames);
}
class NVPTX32TargetInfo : public NVPTXTargetInfo {
@@ -1824,13 +1813,10 @@ public:
return "";
}
- void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const override;
+ ArrayRef<const char *> getGCCRegNames() const override;
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {
- Aliases = nullptr;
- NumAliases = 0;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
+ return None;
}
bool validateAsmConstraint(const char *&Name,
@@ -2007,10 +1993,8 @@ const char * const AMDGPUTargetInfo::GCC
"vcc_lo", "vcc_hi", "flat_scr_lo", "flat_scr_hi"
};
-void AMDGPUTargetInfo::getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ArrayRef<const char *> AMDGPUTargetInfo::getGCCRegNames() const {
+ return llvm::makeArrayRef(GCCRegNames);
}
// Namespace for x86 abstract base class
@@ -2357,20 +2341,14 @@ public:
Records = BuiltinInfo;
NumRecords = clang::X86::LastTSBuiltin-Builtin::FirstTSBuiltin;
}
- void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const override {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
- }
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {
- Aliases = nullptr;
- NumAliases = 0;
- }
- void getGCCAddlRegNames(const AddlRegName *&Names,
- unsigned &NumNames) const override {
- Names = AddlRegNames;
- NumNames = llvm::array_lengthof(AddlRegNames);
+ ArrayRef<const char *> getGCCRegNames() const override {
+ return llvm::makeArrayRef(GCCRegNames);
+ }
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
+ return None;
+ }
+ ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override {
+ return llvm::makeArrayRef(AddlRegNames);
}
bool validateCpuSupports(StringRef Name) const override;
bool validateAsmConstraint(const char *&Name,
@@ -4820,10 +4798,8 @@ public:
BuiltinVaListKind getBuiltinVaListKind() const override {
return IsAAPCS ? AAPCSABIBuiltinVaList : TargetInfo::VoidPtrBuiltinVaList;
}
- void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const override;
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override;
+ ArrayRef<const char *> getGCCRegNames() const override;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &Info) const override {
switch (*Name) {
@@ -4958,10 +4934,8 @@ const char * const ARMTargetInfo::GCCReg
"q8", "q9", "q10", "q11", "q12", "q13", "q14", "q15"
};
-void ARMTargetInfo::getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ArrayRef<const char *> ARMTargetInfo::getGCCRegNames() const {
+ return llvm::makeArrayRef(GCCRegNames);
}
const TargetInfo::GCCRegAlias ARMTargetInfo::GCCRegAliases[] = {
@@ -4985,10 +4959,8 @@ const TargetInfo::GCCRegAlias ARMTargetI
// don't want to substitute one of these for a different-sized one.
};
-void ARMTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const {
- Aliases = GCCRegAliases;
- NumAliases = llvm::array_lengthof(GCCRegAliases);
+ArrayRef<TargetInfo::GCCRegAlias> ARMTargetInfo::getGCCRegAliases() const {
+ return llvm::makeArrayRef(GCCRegAliases);
}
const Builtin::Info ARMTargetInfo::BuiltinInfo[] = {
@@ -5355,10 +5327,8 @@ public:
return TargetInfo::AArch64ABIBuiltinVaList;
}
- void getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const override;
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override;
+ ArrayRef<const char *> getGCCRegNames() const override;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &Info) const override {
@@ -5468,10 +5438,8 @@ const char *const AArch64TargetInfo::GCC
"v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
};
-void AArch64TargetInfo::getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ArrayRef<const char *> AArch64TargetInfo::getGCCRegNames() const {
+ return llvm::makeArrayRef(GCCRegNames);
}
const TargetInfo::GCCRegAlias AArch64TargetInfo::GCCRegAliases[] = {
@@ -5483,10 +5451,8 @@ const TargetInfo::GCCRegAlias AArch64Tar
// don't want to substitute one of these for a different-sized one.
};
-void AArch64TargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const {
- Aliases = GCCRegAliases;
- NumAliases = llvm::array_lengthof(GCCRegAliases);
+ArrayRef<TargetInfo::GCCRegAlias> AArch64TargetInfo::getGCCRegAliases() const {
+ return llvm::makeArrayRef(GCCRegAliases);
}
const Builtin::Info AArch64TargetInfo::BuiltinInfo[] = {
@@ -5607,10 +5573,8 @@ public:
BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::CharPtrBuiltinVaList;
}
- void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const override;
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override;
+ ArrayRef<const char *> getGCCRegNames() const override;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
const char *getClobbers() const override {
return "";
}
@@ -5692,10 +5656,8 @@ const char * const HexagonTargetInfo::GC
"sa0", "lc0", "sa1", "lc1", "m0", "m1", "usr", "ugp"
};
-void HexagonTargetInfo::getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ArrayRef<const char *> HexagonTargetInfo::getGCCRegNames() const {
+ return llvm::makeArrayRef(GCCRegNames);
}
@@ -5705,10 +5667,8 @@ const TargetInfo::GCCRegAlias HexagonTar
{ { "lr" }, "r31" },
};
-void HexagonTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const {
- Aliases = GCCRegAliases;
- NumAliases = llvm::array_lengthof(GCCRegAliases);
+ArrayRef<TargetInfo::GCCRegAlias> HexagonTargetInfo::getGCCRegAliases() const {
+ return llvm::makeArrayRef(GCCRegAliases);
}
@@ -5763,10 +5723,8 @@ public:
BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::VoidPtrBuiltinVaList;
}
- void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const override;
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override;
+ ArrayRef<const char *> getGCCRegNames() const override;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override {
// FIXME: Implement!
@@ -5795,10 +5753,8 @@ const char * const SparcTargetInfo::GCCR
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
};
-void SparcTargetInfo::getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ArrayRef<const char *> SparcTargetInfo::getGCCRegNames() const {
+ return llvm::makeArrayRef(GCCRegNames);
}
const TargetInfo::GCCRegAlias SparcTargetInfo::GCCRegAliases[] = {
@@ -5836,10 +5792,8 @@ const TargetInfo::GCCRegAlias SparcTarge
{ { "i7" }, "r31" },
};
-void SparcTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const {
- Aliases = GCCRegAliases;
- NumAliases = llvm::array_lengthof(GCCRegAliases);
+ArrayRef<TargetInfo::GCCRegAlias> SparcTargetInfo::getGCCRegAliases() const {
+ return llvm::makeArrayRef(GCCRegAliases);
}
// SPARC v8 is the 32-bit mode selected by Triple::sparc.
@@ -5975,13 +5929,10 @@ public:
NumRecords = clang::SystemZ::LastTSBuiltin-Builtin::FirstTSBuiltin;
}
- void getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const override;
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {
+ ArrayRef<const char *> getGCCRegNames() const override;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
// No aliases.
- Aliases = nullptr;
- NumAliases = 0;
+ return None;
}
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override;
@@ -6066,10 +6017,8 @@ const char *const SystemZTargetInfo::GCC
"f8", "f10", "f12", "f14", "f9", "f11", "f13", "f15"
};
-void SystemZTargetInfo::getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ArrayRef<const char *> SystemZTargetInfo::getGCCRegNames() const {
+ return llvm::makeArrayRef(GCCRegNames);
}
bool SystemZTargetInfo::
@@ -6138,13 +6087,10 @@ public:
bool hasFeature(StringRef Feature) const override {
return Feature == "msp430";
}
- void getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const override;
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {
+ ArrayRef<const char *> getGCCRegNames() const override;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
// No aliases.
- Aliases = nullptr;
- NumAliases = 0;
+ return None;
}
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override {
@@ -6172,10 +6118,8 @@ const char *const MSP430TargetInfo::GCCR
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"};
-void MSP430TargetInfo::getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ArrayRef<const char *> MSP430TargetInfo::getGCCRegNames() const {
+ return llvm::makeArrayRef(GCCRegNames);
}
// LLVM and Clang cannot be used directly to output native binaries for
@@ -6241,14 +6185,14 @@ public:
BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::VoidPtrBuiltinVaList;
}
- void getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const override {}
+ ArrayRef<const char *> getGCCRegNames() const override { return None; }
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override {
return true;
}
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {}
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
+ return None;
+ }
};
class BPFTargetInfo : public TargetInfo {
@@ -6289,19 +6233,15 @@ public:
BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::VoidPtrBuiltinVaList;
}
- void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const override {
- Names = nullptr;
- NumNames = 0;
+ ArrayRef<const char *> getGCCRegNames() const override {
+ return None;
}
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override {
return true;
}
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {
- Aliases = nullptr;
- NumAliases = 0;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
+ return None;
}
};
@@ -6457,8 +6397,7 @@ public:
BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::VoidPtrBuiltinVaList;
}
- void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const override {
+ ArrayRef<const char *> getGCCRegNames() const override {
static const char *const GCCRegNames[] = {
// CPU register names
// Must match second column of GCCRegAliases
@@ -6483,11 +6422,9 @@ public:
"$msair", "$msacsr", "$msaaccess", "$msasave", "$msamodify",
"$msarequest", "$msamap", "$msaunmap"
};
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ return llvm::makeArrayRef(GCCRegNames);
}
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override = 0;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override = 0;
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &Info) const override {
switch (*Name) {
@@ -6666,8 +6603,7 @@ public:
else
llvm_unreachable("Invalid ABI for Mips32.");
}
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
static const TargetInfo::GCCRegAlias GCCRegAliases[] = {
{ { "at" }, "$1" },
{ { "v0" }, "$2" },
@@ -6701,8 +6637,7 @@ public:
{ { "fp","$fp" }, "$30" },
{ { "ra" }, "$31" }
};
- Aliases = GCCRegAliases;
- NumAliases = llvm::array_lengthof(GCCRegAliases);
+ return llvm::makeArrayRef(GCCRegAliases);
}
};
@@ -6822,8 +6757,7 @@ public:
else
llvm_unreachable("Invalid ABI for Mips64.");
}
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
static const TargetInfo::GCCRegAlias GCCRegAliases[] = {
{ { "at" }, "$1" },
{ { "v0" }, "$2" },
@@ -6857,8 +6791,7 @@ public:
{ { "fp","$fp" }, "$30" },
{ { "ra" }, "$31" }
};
- Aliases = GCCRegAliases;
- NumAliases = llvm::array_lengthof(GCCRegAliases);
+ return llvm::makeArrayRef(GCCRegAliases);
}
bool hasInt128Type() const override { return true; }
@@ -6942,10 +6875,8 @@ public:
BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::PNaClABIBuiltinVaList;
}
- void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const override;
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override;
+ ArrayRef<const char *> getGCCRegNames() const override;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &Info) const override {
return false;
@@ -6956,16 +6887,12 @@ public:
}
};
-void PNaClTargetInfo::getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const {
- Names = nullptr;
- NumNames = 0;
+ArrayRef<const char *> PNaClTargetInfo::getGCCRegNames() const {
+ return None;
}
-void PNaClTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const {
- Aliases = nullptr;
- NumAliases = 0;
+ArrayRef<TargetInfo::GCCRegAlias> PNaClTargetInfo::getGCCRegAliases() const {
+ return None;
}
// We attempt to use PNaCl (le32) frontend and Mips32EL backend.
@@ -7007,15 +6934,11 @@ public:
return TargetInfo::PNaClABIBuiltinVaList;
}
const char *getClobbers() const override { return ""; }
- void getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const override {
- Names = nullptr;
- NumNames = 0;
- }
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {
- Aliases = nullptr;
- NumAliases = 0;
+ ArrayRef<const char *> getGCCRegNames() const override {
+ return None;
+ }
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
+ return None;
}
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &Info) const override {
@@ -7101,15 +7024,11 @@ private:
// TODO: Implement va_list properly.
return VoidPtrBuiltinVaList;
}
- void getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const final {
- Names = nullptr;
- NumNames = 0;
- }
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const final {
- Aliases = nullptr;
- NumAliases = 0;
+ ArrayRef<const char *> getGCCRegNames() const final {
+ return None;
+ }
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const final {
+ return None;
}
bool
validateAsmConstraint(const char *&Name,
@@ -7218,14 +7137,14 @@ public:
void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const override {}
const char *getClobbers() const override { return ""; }
- void getGCCRegNames(const char *const *&Names,
- unsigned &NumNames) const override {}
+ ArrayRef<const char *> getGCCRegNames() const override { return None; }
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override {
return true;
}
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {}
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
+ return None;
+ }
BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::VoidPtrBuiltinVaList;
}
@@ -7303,19 +7222,15 @@ public:
const char *getClobbers() const override {
return "";
}
- void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const override {
+ ArrayRef<const char *> getGCCRegNames() const override {
static const char * const GCCRegNames[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "cp", "dp", "sp", "lr"
};
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
+ return llvm::makeArrayRef(GCCRegNames);
}
- void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const override {
- Aliases = nullptr;
- NumAliases = 0;
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
+ return None;
}
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &Info) const override {
More information about the cfe-commits
mailing list