Skip to content

Commit

Permalink
Fix mipsisainfo_common and mips32isainfo.h
Browse files Browse the repository at this point in the history
  • Loading branch information
SteliosKaragiorgis committed Sep 27, 2023
1 parent 9d3fb5d commit 6f7c8c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
8 changes: 2 additions & 6 deletions src/isa/mips32isainfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class ISAInfo<ISA::MIPS32I> : public MIPSISAInfoBase {
for (const auto &ext : extensions) {
if (supportsExtension(ext)) {
m_enabledExtensions << ext;
} /*else {
assert(false && "Invalid extension specified for ISA");
}*/
}
}
}

Expand All @@ -29,9 +27,7 @@ class ISAInfo<ISA::MIPS32I> : public MIPSISAInfoBase {
}
QString CCmabi() const override { return "ilp32"; }

unsigned instrByteAlignment() const override {
return extensionEnabled("C") ? 2 : 4;
};
unsigned instrByteAlignment() const override { return 4; };
};

} // namespace Ripes
18 changes: 6 additions & 12 deletions src/isa/mipsisainfo_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,9 @@ class MIPSISAInfoBase : public ISAInfoBase {
public:
unsigned int regCnt() const override { return 34; }
QString regName(unsigned i) const override {
QString regNameDollar = MIPSISA::RegNames.size() > static_cast<int>(i)
? MIPSISA::RegNames.at(static_cast<int>(i))
: QString();
regNameDollar.prepend("$");
regNameDollar.prepend("x");
return (MIPSISA::RegNames.size() > static_cast<int>(i)
? MIPSISA::RegNames.at(static_cast<int>(i))
: QString());
// return regNameDollar;
}
QString regAlias(unsigned i) const override {
return MIPSISA::RegAliases.size() > static_cast<int>(i)
Expand All @@ -167,19 +161,19 @@ class MIPSISAInfoBase : public ISAInfoBase {
unsigned elfMachineId() const override { return EM_MIPS; }
unsigned int regNumber(const QString &reg, bool &success) const override {
QString regRes = reg;
QString regNoDollar = regRes.remove('$');

success = true;
if (reg[0] != '$') {
success = false;
return 0;
}

success = true;
if (reg[0] == '$' && (MIPSISA::RegNames.count(reg) != 0)) {
QString regNoDollar = regRes.remove('$');

if (MIPSISA::RegNames.count(reg) != 0) {
regRes.remove('$');
return regRes.toInt(&success, 10);
} else if (MIPSISA::RegAliases.contains(regNoDollar)) {
return MIPSISA::RegAliases.indexOf(regNoDollar);
} else if (int idx = MIPSISA::RegAliases.indexOf(regNoDollar); idx != -1) {
return idx;
}
success = false;
return 0;
Expand Down

0 comments on commit 6f7c8c6

Please sign in to comment.