A64: The A64SetTPIDR IR instruction writes to a system register and should not be eliminated by the dead code elimination pass.

Previously this instruction was alway eliminated, resulting in incorrect values for TPIDR_EL0.
This commit is contained in:
Subv 2018-07-20 20:20:20 -05:00 committed by MerryMage
parent b53127600b
commit 4606a081c9
2 changed files with 13 additions and 0 deletions

View file

@ -152,6 +152,15 @@ bool Inst::WritesToCPSR() const {
}
}
bool Inst::WritesToSystemRegister() const {
switch (op) {
case Opcode::A64SetTPIDR:
return true;
default:
return false;
}
}
bool Inst::ReadsFromCoreRegister() const {
switch (op) {
case Opcode::A32GetRegister:
@ -287,6 +296,7 @@ bool Inst::MayHaveSideEffects() const {
op == Opcode::A64DataMemoryBarrier ||
CausesCPUException() ||
WritesToCoreRegister() ||
WritesToSystemRegister() ||
WritesToCPSR() ||
WritesToFPSCR() ||
AltersExclusiveState() ||

View file

@ -55,6 +55,9 @@ public:
/// Determines whether or not this instruction writes to the CPSR.
bool WritesToCPSR() const;
/// Determines whether or not this instruction writes to a system register.
bool WritesToSystemRegister() const;
/// Determines whether or not this instruction reads from a core register.
bool ReadsFromCoreRegister() const;
/// Determines whether or not this instruction writes to a core register.