summaryrefslogtreecommitdiff
path: root/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
commit7107aded170612748f46380f21ec6b71dfaf4910 (patch)
tree6960660e3e5b1489f31a8f32015a066e26c9a71e /lib/Target/X86/X86InstrInfo.cpp
parent430b6eb4191579651c630ef2922db22578df9710 (diff)
downloadllvm-7107aded170612748f46380f21ec6b71dfaf4910.tar.gz
llvm-7107aded170612748f46380f21ec6b71dfaf4910.tar.bz2
llvm-7107aded170612748f46380f21ec6b71dfaf4910.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index 75c6c2a755..2351cffdaa 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/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).