From 5b5e37fe5500024bac740de4b79fe28ac2968a5a Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 19 Oct 2015 03:05:12 +0000 Subject: [PATCH] Return an ArrayRef instead of having two out parameters of a pointer and length. NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250676 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/TargetInfo.h | 12 +- lib/Basic/TargetInfo.cpp | 46 ++---- lib/Basic/Targets.cpp | 271 +++++++++++-------------------- 3 files changed, 112 insertions(+), 217 deletions(-) diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 4b82e9a7ce..e5d0ae18b2 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -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 getGCCRegNames() const = 0; + virtual ArrayRef getGCCRegAliases() const = 0; + virtual ArrayRef getGCCAddlRegNames() const { + return None; } }; diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index 5e2d7fb955..21368f8b11 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -349,49 +349,41 @@ bool TargetInfo::isValidGCCRegisterName(StringRef Name) const { 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 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 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 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(StringRef Name) const { // Get rid of any register prefix. Name = removeGCCRegisterPrefix(Name); - const char * const *Names; - unsigned NumNames; - - getGCCRegNames(Names, NumNames); + ArrayRef 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 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 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; diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index d854afdcb4..f6a4e78a82 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -898,10 +898,8 @@ public: void setFeatureEnabled(llvm::StringMap &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 getGCCRegNames() const override; + ArrayRef getGCCRegAliases() const override; bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override { switch (*Name) { @@ -1388,10 +1386,8 @@ const char * const PPCTargetInfo::GCCRegNames[] = { "sfp" }; -void PPCTargetInfo::getGCCRegNames(const char * const *&Names, - unsigned &NumNames) const { - Names = GCCRegNames; - NumNames = llvm::array_lengthof(GCCRegNames); +ArrayRef PPCTargetInfo::getGCCRegNames() const { + return GCCRegNames; } const TargetInfo::GCCRegAlias PPCTargetInfo::GCCRegAliases[] = { @@ -1464,10 +1460,8 @@ const TargetInfo::GCCRegAlias PPCTargetInfo::GCCRegAliases[] = { { { "cc" }, "cr0" }, }; -void PPCTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const { - Aliases = GCCRegAliases; - NumAliases = llvm::array_lengthof(GCCRegAliases); +ArrayRef PPCTargetInfo::getGCCRegAliases() const { + return 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 getGCCRegNames() const override; + ArrayRef 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::BuiltinInfo[] = { const char *const NVPTXTargetInfo::GCCRegNames[] = {"r0"}; -void NVPTXTargetInfo::getGCCRegNames(const char *const *&Names, - unsigned &NumNames) const { - Names = GCCRegNames; - NumNames = llvm::array_lengthof(GCCRegNames); +ArrayRef NVPTXTargetInfo::getGCCRegNames() const { + return GCCRegNames; } class NVPTX32TargetInfo : public NVPTXTargetInfo { @@ -1824,13 +1813,10 @@ public: return ""; } - void getGCCRegNames(const char * const *&Names, - unsigned &NumNames) const override; + ArrayRef getGCCRegNames() const override; - void getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const override { - Aliases = nullptr; - NumAliases = 0; + ArrayRef getGCCRegAliases() const override { + return None; } bool validateAsmConstraint(const char *&Name, @@ -2007,10 +1993,8 @@ const char * const AMDGPUTargetInfo::GCCRegNames[] = { "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 AMDGPUTargetInfo::getGCCRegNames() const { + return 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); + ArrayRef getGCCRegNames() const override { + return GCCRegNames; } - void getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const override { - Aliases = nullptr; - NumAliases = 0; + ArrayRef getGCCRegAliases() const override { + return None; } - void getGCCAddlRegNames(const AddlRegName *&Names, - unsigned &NumNames) const override { - Names = AddlRegNames; - NumNames = llvm::array_lengthof(AddlRegNames); + ArrayRef getGCCAddlRegNames() const override { + return 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 getGCCRegNames() const override; + ArrayRef getGCCRegAliases() const override; bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override { switch (*Name) { @@ -4958,10 +4934,8 @@ const char * const ARMTargetInfo::GCCRegNames[] = { "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 ARMTargetInfo::getGCCRegNames() const { + return GCCRegNames; } const TargetInfo::GCCRegAlias ARMTargetInfo::GCCRegAliases[] = { @@ -4985,10 +4959,8 @@ const TargetInfo::GCCRegAlias ARMTargetInfo::GCCRegAliases[] = { // 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 ARMTargetInfo::getGCCRegAliases() const { + return 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 getGCCRegNames() const override; + ArrayRef getGCCRegAliases() const override; bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override { @@ -5468,10 +5438,8 @@ const char *const AArch64TargetInfo::GCCRegNames[] = { "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 AArch64TargetInfo::getGCCRegNames() const { + return GCCRegNames; } const TargetInfo::GCCRegAlias AArch64TargetInfo::GCCRegAliases[] = { @@ -5483,10 +5451,8 @@ const TargetInfo::GCCRegAlias AArch64TargetInfo::GCCRegAliases[] = { // 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 AArch64TargetInfo::getGCCRegAliases() const { + return 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 getGCCRegNames() const override; + ArrayRef getGCCRegAliases() const override; const char *getClobbers() const override { return ""; } @@ -5692,10 +5656,8 @@ const char * const HexagonTargetInfo::GCCRegNames[] = { "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 HexagonTargetInfo::getGCCRegNames() const { + return GCCRegNames; } @@ -5705,10 +5667,8 @@ const TargetInfo::GCCRegAlias HexagonTargetInfo::GCCRegAliases[] = { { { "lr" }, "r31" }, }; -void HexagonTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const { - Aliases = GCCRegAliases; - NumAliases = llvm::array_lengthof(GCCRegAliases); +ArrayRef HexagonTargetInfo::getGCCRegAliases() const { + return 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 getGCCRegNames() const override; + ArrayRef getGCCRegAliases() const override; bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override { // FIXME: Implement! @@ -5795,10 +5753,8 @@ const char * const SparcTargetInfo::GCCRegNames[] = { "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 SparcTargetInfo::getGCCRegNames() const { + return GCCRegNames;; } const TargetInfo::GCCRegAlias SparcTargetInfo::GCCRegAliases[] = { @@ -5836,10 +5792,8 @@ const TargetInfo::GCCRegAlias SparcTargetInfo::GCCRegAliases[] = { { { "i7" }, "r31" }, }; -void SparcTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const { - Aliases = GCCRegAliases; - NumAliases = llvm::array_lengthof(GCCRegAliases); +ArrayRef SparcTargetInfo::getGCCRegAliases() const { + return 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 getGCCRegNames() const override; + ArrayRef 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::GCCRegNames[] = { "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 SystemZTargetInfo::getGCCRegNames() const { + return 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 getGCCRegNames() const override; + ArrayRef 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::GCCRegNames[] = { "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 MSP430TargetInfo::getGCCRegNames() const { + return 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 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 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 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 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 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 GCCRegNames; } - void getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const override = 0; + ArrayRef 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 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 GCCRegAliases; } }; @@ -6822,8 +6757,7 @@ public: else llvm_unreachable("Invalid ABI for Mips64."); } - void getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const override { + ArrayRef 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 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 getGCCRegNames() const override; + ArrayRef 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 PNaClTargetInfo::getGCCRegNames() const { + return None; } -void PNaClTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const { - Aliases = nullptr; - NumAliases = 0; +ArrayRef 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; + ArrayRef getGCCRegNames() const override { + return None; } - void getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const override { - Aliases = nullptr; - NumAliases = 0; + ArrayRef 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; + ArrayRef getGCCRegNames() const final { + return None; } - void getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const final { - Aliases = nullptr; - NumAliases = 0; + ArrayRef 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 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 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 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 GCCRegNames; } - void getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const override { - Aliases = nullptr; - NumAliases = 0; + ArrayRef getGCCRegAliases() const override { + return None; } bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override { -- 2.40.0