summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86InstrInfo.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-11-12 22:58:39 +0000
committerAndrew Trick <atrick@apple.com>2013-11-12 22:58:39 +0000
commit0ef482ef02cd230f456b051d832920554fe623e5 (patch)
tree5e82bf4c516192c2532967c3876033e9ff7d16f2 /llvm/lib/Target/X86/X86InstrInfo.cpp
parenta1cc34b98132a9a7cf5c4c4f302edc12b00852d0 (diff)
downloadbcm5719-llvm-0ef482ef02cd230f456b051d832920554fe623e5.tar.gz
bcm5719-llvm-0ef482ef02cd230f456b051d832920554fe623e5.zip
Cleanup the stackmap operand folding code and fix a corner case.
I still don't know how to refer to the fixed operands symbolically. I plan to look into it. llvm-svn: 194529
Diffstat (limited to 'llvm/lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r--llvm/lib/Target/X86/X86InstrInfo.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 75c6c2a7553..2351cffdaad 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -4206,12 +4206,18 @@ static MachineInstr* foldPatchpoint(MachineFunction &MF,
MF.CreateMachineInstr(TII.get(MI->getOpcode()), MI->getDebugLoc(), true);
MachineInstrBuilder MIB(MF, NewMI);
- bool isPatchPoint = MI->getOpcode() == TargetOpcode::PATCHPOINT;
- // For PatchPoint, the call args are not foldable.
- unsigned NumCallArgs = MI->getOperand(StartIdx+3).getImm();
- StartIdx = isPatchPoint ?
- StartIdx + NumCallArgs + 5 :
- StartIdx + 2;
+ switch (MI->getOpcode()) {
+ case TargetOpcode::STACKMAP:
+ StartIdx += 2; // Skip ID, nShadowBytes.
+ break;
+ case TargetOpcode::PATCHPOINT:
+ // Skip ID, numBytes, Target, numArgs.
+ // For PatchPoint, the call args are not foldable.
+ StartIdx += MI->getOperand(StartIdx+3).getImm() + 4;
+ break;
+ default:
+ llvm_unreachable("unexpected stackmap opcode");
+ }
// Return false if any operands requested for folding are not foldable (not
// part of the stackmap's live values).
OpenPOWER on IntegriCloud