diff options
author | Andrew Trick <atrick@apple.com> | 2013-11-11 22:40:25 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2013-11-11 22:40:25 +0000 |
commit | 01846af6ed371ebe2dba80cc8cd286b2631d4051 (patch) | |
tree | b7d1c3df24d0aa9bcb6c4f233ab01fa79b80e904 /lib/Target/X86/X86InstrInfo.cpp | |
parent | 5a34980b4e0a60d39ad3acb9dd467b74ce2d830d (diff) | |
download | external_llvm-01846af6ed371ebe2dba80cc8cd286b2631d4051.zip external_llvm-01846af6ed371ebe2dba80cc8cd286b2631d4051.tar.gz external_llvm-01846af6ed371ebe2dba80cc8cd286b2631d4051.tar.bz2 |
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/Target/X86/X86InstrInfo.cpp')
-rw-r--r-- | lib/Target/X86/X86InstrInfo.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index b81b244..eda285b 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)); |