Index: lib/Target/AArch64/AArch64SystemOperands.td =================================================================== --- lib/Target/AArch64/AArch64SystemOperands.td +++ lib/Target/AArch64/AArch64SystemOperands.td @@ -18,11 +18,7 @@ // AT (address translate) instruction options. //===----------------------------------------------------------------------===// -class AT op1, bits<4> crn, bits<4> crm, - bits<3> op2> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - +class AT op1, bits<4> crn, bits<4> crm, bits<3> op2> { string Name = name; bits<14> Encoding; let Encoding{13-11} = op1; @@ -32,6 +28,19 @@ code Requires = [{ {} }]; } +def ATsList : GenericTable { + let FilterClass = "AT"; + let Fields = ["Name", "Encoding", "Requires"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupATByEncoding"; +} + +def lookupATByName : SearchIndex { + let Table = ATsList; + let Key = ["Name"]; +} + def : AT<"S1E1R", 0b000, 0b0111, 0b1000, 0b000>; def : AT<"S1E2R", 0b100, 0b0111, 0b1000, 0b000>; def : AT<"S1E3R", 0b110, 0b0111, 0b1000, 0b000>; @@ -54,14 +63,30 @@ // DMB/DSB (data barrier) instruction options. //===----------------------------------------------------------------------===// -class DB encoding> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - +class DB encoding> { string Name = name; bits<4> Encoding = encoding; } +def DBValues : GenericEnum { + let FilterClass = "DB"; + let NameField = "Name"; + let ValueField = "Encoding"; +} + +def DBsList : GenericTable { + let FilterClass = "DB"; + let Fields = ["Name", "Encoding"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupDBByEncoding"; +} + +def lookupDBByName : SearchIndex { + let Table = DBsList; + let Key = ["Name"]; +} + def : DB<"oshld", 0x1>; def : DB<"oshst", 0x2>; def : DB<"osh", 0x3>; @@ -79,11 +104,7 @@ // DC (data cache maintenance) instruction options. //===----------------------------------------------------------------------===// -class DC op1, bits<4> crn, bits<4> crm, - bits<3> op2> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - +class DC op1, bits<4> crn, bits<4> crm, bits<3> op2> { string Name = name; bits<14> Encoding; let Encoding{13-11} = op1; @@ -93,6 +114,19 @@ code Requires = [{ {} }]; } +def DCsList : GenericTable { + let FilterClass = "DC"; + let Fields = ["Name", "Encoding", "Requires"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupDCByEncoding"; +} + +def lookupDCByName : SearchIndex { + let Table = DCsList; + let Key = ["Name"]; +} + def : DC<"ZVA", 0b011, 0b0111, 0b0100, 0b001>; def : DC<"IVAC", 0b000, 0b0111, 0b0110, 0b001>; def : DC<"ISW", 0b000, 0b0111, 0b0110, 0b010>; @@ -110,10 +144,7 @@ //===----------------------------------------------------------------------===// class IC op1, bits<4> crn, bits<4> crm, bits<3> op2, - bit needsreg> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - + bit needsreg> { string Name = name; bits<14> Encoding; let Encoding{13-11} = op1; @@ -123,6 +154,19 @@ bit NeedsReg = needsreg; } +def ICsList : GenericTable { + let FilterClass = "IC"; + let Fields = ["Name", "Encoding", "NeedsReg"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupICByEncoding"; +} + +def lookupICByName : SearchIndex { + let Table = ICsList; + let Key = ["Name"]; +} + def : IC<"IALLUIS", 0b000, 0b0111, 0b0001, 0b000, 0>; def : IC<"IALLU", 0b000, 0b0111, 0b0101, 0b000, 0>; def : IC<"IVAU", 0b011, 0b0111, 0b0101, 0b001, 1>; @@ -131,30 +175,50 @@ // ISB (instruction-fetch barrier) instruction options. //===----------------------------------------------------------------------===// -class ISB encoding> : SearchableTable{ - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - +class ISB encoding> { string Name = name; bits<4> Encoding; let Encoding = encoding; } +def ISBsList : GenericTable { + let FilterClass = "ISB"; + let Fields = ["Name", "Encoding"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupISBByEncoding"; +} + +def lookupISBByName : SearchIndex { + let Table = ISBsList; + let Key = ["Name"]; +} + def : ISB<"sy", 0xf>; //===----------------------------------------------------------------------===// // PRFM (prefetch) instruction options. //===----------------------------------------------------------------------===// -class PRFM encoding> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - +class PRFM encoding> { string Name = name; bits<5> Encoding; let Encoding = encoding; } +def PRFMsList : GenericTable { + let FilterClass = "PRFM"; + let Fields = ["Name", "Encoding"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupPRFMByEncoding"; +} + +def lookupPRFMByName : SearchIndex { + let Table = PRFMsList; + let Key = ["Name"]; +} + def : PRFM<"pldl1keep", 0x00>; def : PRFM<"pldl1strm", 0x01>; def : PRFM<"pldl2keep", 0x02>; @@ -178,16 +242,26 @@ // SVE Prefetch instruction options. //===----------------------------------------------------------------------===// -class SVEPRFM encoding> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - +class SVEPRFM encoding> { string Name = name; bits<4> Encoding; let Encoding = encoding; code Requires = [{ {} }]; } +def SVEPRFMsList : GenericTable { + let FilterClass = "SVEPRFM"; + let Fields = ["Name", "Encoding", "Requires"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupSVEPRFMByEncoding"; +} + +def lookupSVEPRFMByName : SearchIndex { + let Table = SVEPRFMsList; + let Key = ["Name"]; +} + let Requires = [{ {AArch64::FeatureSVE} }] in { def : SVEPRFM<"pldl1keep", 0x00>; def : SVEPRFM<"pldl1strm", 0x01>; @@ -207,15 +281,25 @@ // SVE Predicate patterns //===----------------------------------------------------------------------===// -class SVEPREDPAT encoding> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - +class SVEPREDPAT encoding> { string Name = name; bits<5> Encoding; let Encoding = encoding; } +def SVEPREDPATsList : GenericTable { + let FilterClass = "SVEPREDPAT"; + let Fields = ["Name", "Encoding"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupSVEPREDPATByEncoding"; +} + +def lookupSVEPREDPATByName : SearchIndex { + let Table = SVEPREDPATsList; + let Key = ["Name"]; +} + def : SVEPREDPAT<"pow2", 0x00>; def : SVEPREDPAT<"vl1", 0x01>; def : SVEPREDPAT<"vl2", 0x02>; @@ -238,16 +322,32 @@ // PState instruction options. //===----------------------------------------------------------------------===// -class PState encoding> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - +class PState encoding> { string Name = name; bits<5> Encoding; let Encoding = encoding; code Requires = [{ {} }]; } +def PStateValues : GenericEnum { + let FilterClass = "PState"; + let NameField = "Name"; + let ValueField = "Encoding"; +} + +def PStatesList : GenericTable { + let FilterClass = "PState"; + let Fields = ["Name", "Encoding", "Requires"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupPStateByEncoding"; +} + +def lookupPStateByName : SearchIndex { + let Table = PStatesList; + let Key = ["Name"]; +} + def : PState<"SPSel", 0b00101>; def : PState<"DAIFSet", 0b11110>; def : PState<"DAIFClr", 0b11111>; @@ -263,15 +363,25 @@ // PSB instruction options. //===----------------------------------------------------------------------===// -class PSB encoding> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - +class PSB encoding> { string Name = name; bits<5> Encoding; let Encoding = encoding; } +def PSBsList : GenericTable { + let FilterClass = "PSB"; + let Fields = ["Name", "Encoding"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupPSBByEncoding"; +} + +def lookupPSBByName : SearchIndex { + let Table = PSBsList; + let Key = ["Name"]; +} + def : PSB<"csync", 0x11>; //===----------------------------------------------------------------------===// @@ -279,10 +389,7 @@ //===----------------------------------------------------------------------===// class TLBI op1, bits<4> crn, bits<4> crm, - bits<3> op2, bit needsreg = 1> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - + bits<3> op2, bit needsreg = 1> { string Name = name; bits<14> Encoding; let Encoding{13-11} = op1; @@ -292,6 +399,19 @@ bit NeedsReg = needsreg; } +def TLBIsList : GenericTable { + let FilterClass = "TLBI"; + let Fields = ["Name", "Encoding", "NeedsReg"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupTLBIByEncoding"; +} + +def lookupTLBIByName : SearchIndex { + let Table = TLBIsList; + let Key = ["Name"]; +} + def : TLBI<"IPAS2E1IS", 0b100, 0b1000, 0b0000, 0b001>; def : TLBI<"IPAS2LE1IS", 0b100, 0b1000, 0b0000, 0b101>; def : TLBI<"VMALLE1IS", 0b000, 0b1000, 0b0011, 0b000, 0>; @@ -331,10 +451,7 @@ //===----------------------------------------------------------------------===// class SysReg op0, bits<3> op1, bits<4> crn, bits<4> crm, - bits<3> op2> : SearchableTable { - let SearchableFields = ["Name", "Encoding"]; - let EnumValueField = "Encoding"; - + bits<3> op2> { string Name = name; bits<16> Encoding; let Encoding{15-14} = op0; @@ -347,6 +464,25 @@ code Requires = [{ {} }]; } +def SysRegValues : GenericEnum { + let FilterClass = "SysReg"; + let NameField = "Name"; + let ValueField = "Encoding"; +} + +def SysRegsList : GenericTable { + let FilterClass = "SysReg"; + let Fields = ["Name", "Encoding", "Readable", "Writeable", "Requires"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupSysRegByEncoding"; +} + +def lookupSysRegByName : SearchIndex { + let Table = SysRegsList; + let Key = ["Name"]; +} + class RWSysReg op0, bits<3> op1, bits<4> crn, bits<4> crm, bits<3> op2> : SysReg { Index: lib/Target/AArch64/Utils/AArch64BaseInfo.h =================================================================== --- lib/Target/AArch64/Utils/AArch64BaseInfo.h +++ lib/Target/AArch64/Utils/AArch64BaseInfo.h @@ -291,7 +291,7 @@ struct AT : SysAlias { using SysAlias::SysAlias; }; - #define GET_AT_DECL + #define GET_ATSLIST_DECL #include "AArch64GenSystemOperands.inc" } @@ -299,7 +299,8 @@ struct DB : SysAlias { using SysAlias::SysAlias; }; - #define GET_DB_DECL + #define GET_DBVALUES_DECL + #define GET_DBSLIST_DECL #include "AArch64GenSystemOperands.inc" } @@ -307,7 +308,7 @@ struct DC : SysAlias { using SysAlias::SysAlias; }; - #define GET_DC_DECL + #define GET_DCSLIST_DECL #include "AArch64GenSystemOperands.inc" } @@ -315,7 +316,7 @@ struct IC : SysAliasReg { using SysAliasReg::SysAliasReg; }; - #define GET_IC_DECL + #define GET_ICSLIST_DECL #include "AArch64GenSystemOperands.inc" } @@ -323,7 +324,7 @@ struct ISB : SysAlias { using SysAlias::SysAlias; }; - #define GET_ISB_DECL + #define GET_ISBSLIST_DECL #include "AArch64GenSystemOperands.inc" } @@ -331,7 +332,7 @@ struct PRFM : SysAlias { using SysAlias::SysAlias; }; - #define GET_PRFM_DECL + #define GET_PRFMSLIST_DECL #include "AArch64GenSystemOperands.inc" } @@ -339,7 +340,7 @@ struct SVEPRFM : SysAlias { using SysAlias::SysAlias; }; -#define GET_SVEPRFM_DECL +#define GET_SVEPRFMSLIST_DECL #include "AArch64GenSystemOperands.inc" } @@ -348,7 +349,7 @@ const char *Name; uint16_t Encoding; }; -#define GET_SVEPREDPAT_DECL +#define GET_SVEPREDPATSLIST_DECL #include "AArch64GenSystemOperands.inc" } @@ -356,7 +357,8 @@ struct PState : SysAlias{ using SysAlias::SysAlias; }; - #define GET_PSTATE_DECL + #define GET_PSTATEVALUES_DECL + #define GET_PSTATESLIST_DECL #include "AArch64GenSystemOperands.inc" } @@ -364,7 +366,7 @@ struct PSB : SysAlias { using SysAlias::SysAlias; }; - #define GET_PSB_DECL + #define GET_PSBSLIST_DECL #include "AArch64GenSystemOperands.inc" } @@ -461,7 +463,8 @@ } }; - #define GET_SYSREG_DECL + #define GET_SYSREGVALUES_DECL + #define GET_SYSREGSLIST_DECL #include "AArch64GenSystemOperands.inc" const SysReg *lookupSysRegByName(StringRef); @@ -475,7 +478,7 @@ struct TLBI : SysAliasReg { using SysAliasReg::SysAliasReg; }; - #define GET_TLBI_DECL + #define GET_TLBISLIST_DECL #include "AArch64GenSystemOperands.inc" } Index: lib/Target/AArch64/Utils/AArch64BaseInfo.cpp =================================================================== --- lib/Target/AArch64/Utils/AArch64BaseInfo.cpp +++ lib/Target/AArch64/Utils/AArch64BaseInfo.cpp @@ -20,7 +20,7 @@ namespace llvm { namespace AArch64AT { -#define GET_AT_IMPL +#define GET_ATSLIST_IMPL #include "AArch64GenSystemOperands.inc" } } @@ -28,69 +28,69 @@ namespace llvm { namespace AArch64DB { -#define GET_DB_IMPL +#define GET_DBSLIST_IMPL #include "AArch64GenSystemOperands.inc" } } namespace llvm { namespace AArch64DC { -#define GET_DC_IMPL +#define GET_DCSLIST_IMPL #include "AArch64GenSystemOperands.inc" } } namespace llvm { namespace AArch64IC { -#define GET_IC_IMPL +#define GET_ICSLIST_IMPL #include "AArch64GenSystemOperands.inc" } } namespace llvm { namespace AArch64ISB { -#define GET_ISB_IMPL +#define GET_ISBSLIST_IMPL #include "AArch64GenSystemOperands.inc" } } namespace llvm { namespace AArch64PRFM { -#define GET_PRFM_IMPL +#define GET_PRFMSLIST_IMPL #include "AArch64GenSystemOperands.inc" } } namespace llvm { namespace AArch64SVEPRFM { -#define GET_SVEPRFM_IMPL +#define GET_SVEPRFMSLIST_IMPL #include "AArch64GenSystemOperands.inc" } } namespace llvm { namespace AArch64SVEPredPattern { -#define GET_SVEPREDPAT_IMPL +#define GET_SVEPREDPATSLIST_IMPL #include "AArch64GenSystemOperands.inc" } } namespace llvm { namespace AArch64PState { -#define GET_PSTATE_IMPL +#define GET_PSTATESLIST_IMPL #include "AArch64GenSystemOperands.inc" } } namespace llvm { namespace AArch64PSBHint { -#define GET_PSB_IMPL +#define GET_PSBSLIST_IMPL #include "AArch64GenSystemOperands.inc" } } namespace llvm { namespace AArch64SysReg { -#define GET_SYSREG_IMPL +#define GET_SYSREGSLIST_IMPL #include "AArch64GenSystemOperands.inc" } } @@ -130,7 +130,7 @@ namespace llvm { namespace AArch64TLBI { -#define GET_TLBI_IMPL +#define GET_TLBISLIST_IMPL #include "AArch64GenSystemOperands.inc" } } Index: lib/Target/ARM/ARMSystemRegister.td =================================================================== --- lib/Target/ARM/ARMSystemRegister.td +++ lib/Target/ARM/ARMSystemRegister.td @@ -20,17 +20,13 @@ bits<1> UniqMask2, bits<1> UniqMask3, bits<12> Enc12, - string name> : SearchableTable { - let SearchableFields = ["Name", "M1Encoding12", "M2M3Encoding8", "Encoding"]; + string name> { string Name; bits<13> M1Encoding12; bits<10> M2M3Encoding8; bits<12> Encoding; let Name = name; - let EnumValueField = "M1Encoding12"; - let EnumValueField = "M2M3Encoding8"; - let EnumValueField = "Encoding"; let M1Encoding12{12} = UniqMask1; let M1Encoding12{11-00} = Enc12; @@ -42,6 +38,30 @@ code Requires = [{ {} }]; } +def MClassSysRegValues : GenericEnum { + let FilterClass = "MClassSysReg"; + let NameField = "Name"; + let ValueField = "Encoding"; +} + +def MClassSysRegsList : GenericTable { + let FilterClass = "MClassSysReg"; + let Fields = ["Name", "M1Encoding12", "M2M3Encoding8", "Encoding", "Requires"]; + + let PrimaryKey = ["M1Encoding12"]; + let PrimaryKeyName = "lookupMClassSysRegByM1Encoding12"; +} + +def lookupMClassSysRegByM2M3Encoding8 : SearchIndex { + let Table = MClassSysRegsList; + let Key = ["M2M3Encoding8"]; +} + +def lookupMClassSysRegByName : SearchIndex { + let Table = MClassSysRegsList; + let Key = ["Name"]; +} + // [|i|e|x]apsr_nzcvq has alias [|i|e|x]apsr. // Mask1 Mask2 Mask3 Enc12, Name let Requires = [{ {ARM::FeatureDSP} }] in { @@ -110,13 +130,24 @@ // Banked Registers // -class BankedReg enc> - : SearchableTable { +class BankedReg enc> { string Name; bits<8> Encoding; let Name = name; let Encoding = enc; - let SearchableFields = ["Name", "Encoding"]; +} + +def BankedRegsList : GenericTable { + let FilterClass = "BankedReg"; + let Fields = ["Name", "Encoding"]; + + let PrimaryKey = ["Encoding"]; + let PrimaryKeyName = "lookupBankedRegByEncoding"; +} + +def lookupBankedRegByName : SearchIndex { + let Table = BankedRegsList; + let Key = ["Name"]; } // The values here come from B9.2.3 of the ARM ARM, where bits 4-0 are SysM Index: lib/Target/ARM/Utils/ARMBaseInfo.h =================================================================== --- lib/Target/ARM/Utils/ARMBaseInfo.h +++ lib/Target/ARM/Utils/ARMBaseInfo.h @@ -130,7 +130,8 @@ } }; - #define GET_MCLASSSYSREG_DECL + #define GET_MCLASSSYSREGVALUES_DECL + #define GET_MCLASSSYSREGSLIST_DECL #include "ARMGenSystemRegister.inc" // lookup system register using 12-bit SYSm value. @@ -152,7 +153,7 @@ const char *Name; uint16_t Encoding; }; - #define GET_BANKEDREG_DECL + #define GET_BANKEDREGSLIST_DECL #include "ARMGenSystemRegister.inc" } // end namespace ARMBankedReg Index: lib/Target/ARM/Utils/ARMBaseInfo.cpp =================================================================== --- lib/Target/ARM/Utils/ARMBaseInfo.cpp +++ lib/Target/ARM/Utils/ARMBaseInfo.cpp @@ -35,13 +35,13 @@ return ARMSysReg::lookupMClassSysRegByM2M3Encoding8((1<<8)|(SYSm & 0xFF)); } -#define GET_MCLASSSYSREG_IMPL +#define GET_MCLASSSYSREGSLIST_IMPL #include "ARMGenSystemRegister.inc" } // end namespace ARMSysReg namespace ARMBankedReg { -#define GET_BANKEDREG_IMPL +#define GET_BANKEDREGSLIST_IMPL #include "ARMGenSystemRegister.inc" } // end namespce ARMSysReg } // end namespace llvm