mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-27 06:54:30 +00:00
ARM: Use methods to access data stored with frame instructions
In r300196 several methods were added to TarfetInstrInfo to access data stored with call frame setup/destroy instructions. This change replaces calls to getOperand with calls to such special methods in ARM target. Differential Revision: https://reviews.llvm.org/D32127 llvm-svn: 300655
This commit is contained in:
parent
1963bafdf3
commit
b972759f78
@ -404,6 +404,29 @@ public:
|
|||||||
/// Returns true if the instruction has a shift by immediate that can be
|
/// Returns true if the instruction has a shift by immediate that can be
|
||||||
/// executed in one cycle less.
|
/// executed in one cycle less.
|
||||||
bool isSwiftFastImmShift(const MachineInstr *MI) const;
|
bool isSwiftFastImmShift(const MachineInstr *MI) const;
|
||||||
|
|
||||||
|
/// Returns predicate register associated with the given frame instruction.
|
||||||
|
unsigned getFramePred(const MachineInstr &MI) const {
|
||||||
|
assert(isFrameInstr(MI));
|
||||||
|
if (isFrameSetup(MI))
|
||||||
|
// Operands of ADJCALLSTACKDOWN:
|
||||||
|
// - argument declared in ADJCALLSTACKDOWN pattern:
|
||||||
|
// 0 - frame size
|
||||||
|
// 1 - predicate code (like ARMCC::AL)
|
||||||
|
// - added by predOps:
|
||||||
|
// 2 - predicate reg
|
||||||
|
return MI.getOperand(2).getReg();
|
||||||
|
assert(MI.getOpcode() == ARM::ADJCALLSTACKUP ||
|
||||||
|
MI.getOpcode() == ARM::tADJCALLSTACKUP);
|
||||||
|
// Operands of ADJCALLSTACKUP:
|
||||||
|
// - argument declared in ADJCALLSTACKUP pattern:
|
||||||
|
// 0 - frame size
|
||||||
|
// 1 - arg of CALLSEQ_END
|
||||||
|
// 2 - predicate code
|
||||||
|
// - added by predOps:
|
||||||
|
// 3 - predicate reg
|
||||||
|
return MI.getOperand(3).getReg();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Get the operands corresponding to the given \p Pred value. By default, the
|
/// Get the operands corresponding to the given \p Pred value. By default, the
|
||||||
|
@ -1991,7 +1991,7 @@ MachineBasicBlock::iterator ARMFrameLowering::eliminateCallFramePseudoInstr(
|
|||||||
// ADJCALLSTACKUP -> add, sp, sp, amount
|
// ADJCALLSTACKUP -> add, sp, sp, amount
|
||||||
MachineInstr &Old = *I;
|
MachineInstr &Old = *I;
|
||||||
DebugLoc dl = Old.getDebugLoc();
|
DebugLoc dl = Old.getDebugLoc();
|
||||||
unsigned Amount = Old.getOperand(0).getImm();
|
unsigned Amount = TII.getFrameSize(Old);
|
||||||
if (Amount != 0) {
|
if (Amount != 0) {
|
||||||
// We need to keep the stack aligned properly. To do this, we round the
|
// We need to keep the stack aligned properly. To do this, we round the
|
||||||
// amount of space needed for the outgoing arguments up to the next
|
// amount of space needed for the outgoing arguments up to the next
|
||||||
@ -2009,14 +2009,11 @@ MachineBasicBlock::iterator ARMFrameLowering::eliminateCallFramePseudoInstr(
|
|||||||
ARMCC::CondCodes Pred =
|
ARMCC::CondCodes Pred =
|
||||||
(PIdx == -1) ? ARMCC::AL
|
(PIdx == -1) ? ARMCC::AL
|
||||||
: (ARMCC::CondCodes)Old.getOperand(PIdx).getImm();
|
: (ARMCC::CondCodes)Old.getOperand(PIdx).getImm();
|
||||||
|
unsigned PredReg = TII.getFramePred(Old);
|
||||||
if (Opc == ARM::ADJCALLSTACKDOWN || Opc == ARM::tADJCALLSTACKDOWN) {
|
if (Opc == ARM::ADJCALLSTACKDOWN || Opc == ARM::tADJCALLSTACKDOWN) {
|
||||||
// Note: PredReg is operand 2 for ADJCALLSTACKDOWN.
|
|
||||||
unsigned PredReg = Old.getOperand(2).getReg();
|
|
||||||
emitSPUpdate(isARM, MBB, I, dl, TII, -Amount, MachineInstr::NoFlags,
|
emitSPUpdate(isARM, MBB, I, dl, TII, -Amount, MachineInstr::NoFlags,
|
||||||
Pred, PredReg);
|
Pred, PredReg);
|
||||||
} else {
|
} else {
|
||||||
// Note: PredReg is operand 3 for ADJCALLSTACKUP.
|
|
||||||
unsigned PredReg = Old.getOperand(3).getReg();
|
|
||||||
assert(Opc == ARM::ADJCALLSTACKUP || Opc == ARM::tADJCALLSTACKUP);
|
assert(Opc == ARM::ADJCALLSTACKUP || Opc == ARM::tADJCALLSTACKUP);
|
||||||
emitSPUpdate(isARM, MBB, I, dl, TII, Amount, MachineInstr::NoFlags,
|
emitSPUpdate(isARM, MBB, I, dl, TII, Amount, MachineInstr::NoFlags,
|
||||||
Pred, PredReg);
|
Pred, PredReg);
|
||||||
|
@ -83,13 +83,12 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
|||||||
// ADJCALLSTACKUP -> add, sp, sp, amount
|
// ADJCALLSTACKUP -> add, sp, sp, amount
|
||||||
MachineInstr &Old = *I;
|
MachineInstr &Old = *I;
|
||||||
DebugLoc dl = Old.getDebugLoc();
|
DebugLoc dl = Old.getDebugLoc();
|
||||||
unsigned Amount = Old.getOperand(0).getImm();
|
unsigned Amount = TII.getFrameSize(Old);
|
||||||
if (Amount != 0) {
|
if (Amount != 0) {
|
||||||
// We need to keep the stack aligned properly. To do this, we round the
|
// We need to keep the stack aligned properly. To do this, we round the
|
||||||
// amount of space needed for the outgoing arguments up to the next
|
// amount of space needed for the outgoing arguments up to the next
|
||||||
// alignment boundary.
|
// alignment boundary.
|
||||||
unsigned Align = getStackAlignment();
|
Amount = alignTo(Amount, getStackAlignment());
|
||||||
Amount = (Amount+Align-1)/Align*Align;
|
|
||||||
|
|
||||||
// Replace the pseudo instruction with a new instruction...
|
// Replace the pseudo instruction with a new instruction...
|
||||||
unsigned Opc = Old.getOpcode();
|
unsigned Opc = Old.getOpcode();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user