mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
[AArch64] Don't store available subtarget features in AArch64SysReg::SysRegMapper
Subtarget features must not be a part of the target machine. So, they are now not being stored in SysRegMapper, but provided each time fromString()/toString() are called Reviewers: jmolloy Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8655 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233386 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c18ea8d96e
commit
0c27224d25
@ -2638,13 +2638,15 @@ AArch64AsmParser::tryParseSysReg(OperandVector &Operands) {
|
||||
return MatchOperand_NoMatch;
|
||||
|
||||
bool IsKnown;
|
||||
auto MRSMapper = AArch64SysReg::MRSMapper(STI.getFeatureBits());
|
||||
uint32_t MRSReg = MRSMapper.fromString(Tok.getString(), IsKnown);
|
||||
auto MRSMapper = AArch64SysReg::MRSMapper();
|
||||
uint32_t MRSReg = MRSMapper.fromString(Tok.getString(), STI.getFeatureBits(),
|
||||
IsKnown);
|
||||
assert(IsKnown == (MRSReg != -1U) &&
|
||||
"register should be -1 if and only if it's unknown");
|
||||
|
||||
auto MSRMapper = AArch64SysReg::MSRMapper(STI.getFeatureBits());
|
||||
uint32_t MSRReg = MSRMapper.fromString(Tok.getString(), IsKnown);
|
||||
auto MSRMapper = AArch64SysReg::MSRMapper();
|
||||
uint32_t MSRReg = MSRMapper.fromString(Tok.getString(), STI.getFeatureBits(),
|
||||
IsKnown);
|
||||
assert(IsKnown == (MSRReg != -1U) &&
|
||||
"register should be -1 if and only if it's unknown");
|
||||
|
||||
|
@ -1276,8 +1276,8 @@ void AArch64InstPrinter::printMRSSystemRegister(const MCInst *MI, unsigned OpNo,
|
||||
raw_ostream &O) {
|
||||
unsigned Val = MI->getOperand(OpNo).getImm();
|
||||
|
||||
auto Mapper = AArch64SysReg::MRSMapper(getAvailableFeatures());
|
||||
std::string Name = Mapper.toString(Val);
|
||||
auto Mapper = AArch64SysReg::MRSMapper();
|
||||
std::string Name = Mapper.toString(Val, getAvailableFeatures());
|
||||
|
||||
O << StringRef(Name).upper();
|
||||
}
|
||||
@ -1286,8 +1286,8 @@ void AArch64InstPrinter::printMSRSystemRegister(const MCInst *MI, unsigned OpNo,
|
||||
raw_ostream &O) {
|
||||
unsigned Val = MI->getOperand(OpNo).getImm();
|
||||
|
||||
auto Mapper = AArch64SysReg::MSRMapper(getAvailableFeatures());
|
||||
std::string Name = Mapper.toString(Val);
|
||||
auto Mapper = AArch64SysReg::MSRMapper();
|
||||
std::string Name = Mapper.toString(Val, getAvailableFeatures());
|
||||
|
||||
O << StringRef(Name).upper();
|
||||
}
|
||||
|
@ -245,8 +245,7 @@ const AArch64NamedImmMapper::Mapping AArch64SysReg::MRSMapper::MRSMappings[] = {
|
||||
{"ich_elsr_el2", ICH_ELSR_EL2}
|
||||
};
|
||||
|
||||
AArch64SysReg::MRSMapper::MRSMapper(uint64_t FeatureBits)
|
||||
: SysRegMapper(FeatureBits) {
|
||||
AArch64SysReg::MRSMapper::MRSMapper() {
|
||||
InstMappings = &MRSMappings[0];
|
||||
NumInstMappings = llvm::array_lengthof(MRSMappings);
|
||||
}
|
||||
@ -269,8 +268,7 @@ const AArch64NamedImmMapper::Mapping AArch64SysReg::MSRMapper::MSRMappings[] = {
|
||||
{"icc_sgi0r_el1", ICC_SGI0R_EL1}
|
||||
};
|
||||
|
||||
AArch64SysReg::MSRMapper::MSRMapper(uint64_t FeatureBits)
|
||||
: SysRegMapper(FeatureBits) {
|
||||
AArch64SysReg::MSRMapper::MSRMapper() {
|
||||
InstMappings = &MSRMappings[0];
|
||||
NumInstMappings = llvm::array_lengthof(MSRMappings);
|
||||
}
|
||||
@ -761,7 +759,8 @@ AArch64SysReg::SysRegMapper::CycloneSysRegMappings[] = {
|
||||
};
|
||||
|
||||
uint32_t
|
||||
AArch64SysReg::SysRegMapper::fromString(StringRef Name, bool &Valid) const {
|
||||
AArch64SysReg::SysRegMapper::fromString(StringRef Name, uint64_t FeatureBits,
|
||||
bool &Valid) const {
|
||||
std::string NameLower = Name.lower();
|
||||
|
||||
// First search the registers shared by all
|
||||
@ -814,7 +813,7 @@ AArch64SysReg::SysRegMapper::fromString(StringRef Name, bool &Valid) const {
|
||||
}
|
||||
|
||||
std::string
|
||||
AArch64SysReg::SysRegMapper::toString(uint32_t Bits) const {
|
||||
AArch64SysReg::SysRegMapper::toString(uint32_t Bits, uint64_t FeatureBits) const {
|
||||
// First search the registers shared by all
|
||||
for (unsigned i = 0; i < array_lengthof(SysRegMappings); ++i) {
|
||||
if (SysRegMappings[i].Value == Bits) {
|
||||
|
@ -1139,21 +1139,20 @@ namespace AArch64SysReg {
|
||||
|
||||
const AArch64NamedImmMapper::Mapping *InstMappings;
|
||||
size_t NumInstMappings;
|
||||
uint64_t FeatureBits;
|
||||
|
||||
SysRegMapper(uint64_t FeatureBits) : FeatureBits(FeatureBits) { }
|
||||
uint32_t fromString(StringRef Name, bool &Valid) const;
|
||||
std::string toString(uint32_t Bits) const;
|
||||
SysRegMapper() { }
|
||||
uint32_t fromString(StringRef Name, uint64_t FeatureBits, bool &Valid) const;
|
||||
std::string toString(uint32_t Bits, uint64_t FeatureBits) const;
|
||||
};
|
||||
|
||||
struct MSRMapper : SysRegMapper {
|
||||
static const AArch64NamedImmMapper::Mapping MSRMappings[];
|
||||
MSRMapper(uint64_t FeatureBits);
|
||||
MSRMapper();
|
||||
};
|
||||
|
||||
struct MRSMapper : SysRegMapper {
|
||||
static const AArch64NamedImmMapper::Mapping MRSMappings[];
|
||||
MRSMapper(uint64_t FeatureBits);
|
||||
MRSMapper();
|
||||
};
|
||||
|
||||
uint32_t ParseGenericRegister(StringRef Name, bool &Valid);
|
||||
|
Loading…
Reference in New Issue
Block a user