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 { bool Inst::ReadsFromCoreRegister() const {
switch (op) { switch (op) {
case Opcode::A32GetRegister: case Opcode::A32GetRegister:
@ -287,6 +296,7 @@ bool Inst::MayHaveSideEffects() const {
op == Opcode::A64DataMemoryBarrier || op == Opcode::A64DataMemoryBarrier ||
CausesCPUException() || CausesCPUException() ||
WritesToCoreRegister() || WritesToCoreRegister() ||
WritesToSystemRegister() ||
WritesToCPSR() || WritesToCPSR() ||
WritesToFPSCR() || WritesToFPSCR() ||
AltersExclusiveState() || AltersExclusiveState() ||

View file

@ -55,6 +55,9 @@ public:
/// Determines whether or not this instruction writes to the CPSR. /// Determines whether or not this instruction writes to the CPSR.
bool WritesToCPSR() const; 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. /// Determines whether or not this instruction reads from a core register.
bool ReadsFromCoreRegister() const; bool ReadsFromCoreRegister() const;
/// Determines whether or not this instruction writes to a core register. /// Determines whether or not this instruction writes to a core register.