summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-11-11 22:40:25 +0000
committerAndrew Trick <atrick@apple.com>2013-11-11 22:40:25 +0000
commit01846af6ed371ebe2dba80cc8cd286b2631d4051 (patch)
treeb7d1c3df24d0aa9bcb6c4f233ab01fa79b80e904 /lib
parent5a34980b4e0a60d39ad3acb9dd467b74ce2d830d (diff)
downloadllvm-01846af6ed371ebe2dba80cc8cd286b2631d4051.tar.gz
llvm-01846af6ed371ebe2dba80cc8cd286b2631d4051.tar.bz2
llvm-01846af6ed371ebe2dba80cc8cd286b2631d4051.tar.xz
Fix the recently added anyregcc convention to handle spilled operands.
Fixes <rdar://15432754> [JS] Assertion: "Folded a def to a non-store!" The primary purpose of anyregcc is to prevent a patchpoint's call arguments and return value from being spilled. They must be available in a register, although the calling convention does not pin the register. It's up to the front end to avoid using this convention for calls with more arguments than allocatable registers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194428 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index b81b244828..eda285b861 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -4207,10 +4207,19 @@ static MachineInstr* foldPatchpoint(MachineFunction &MF,
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 + MI->getOperand(StartIdx+3).getImm() + 5 :
+ StartIdx + NumCallArgs + 5 :
StartIdx + 2;
+ // Return false if any operands requested for folding are not foldable (not
+ // part of the stackmap's live values).
+ for (SmallVectorImpl<unsigned>::const_iterator I = Ops.begin(), E = Ops.end();
+ I != E; ++I) {
+ if (*I < StartIdx)
+ return 0;
+ }
// No need to fold return, the meta data, and function arguments
for (unsigned i = 0; i < StartIdx; ++i)
MIB.addOperand(MI->getOperand(i));