summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2014-03-05 07:08:16 +0000
committerAndrew Trick <atrick@apple.com>2014-03-05 07:08:16 +0000
commita6ace00520a9df552ecfec6557f830ef805bea37 (patch)
treeff14f611c8ae9461fe2de43dcb308ea7c0aa82b5 /lib
parent98f54c09d086f76fa0ec81fc2c01d45bfe5a3739 (diff)
downloadllvm-a6ace00520a9df552ecfec6557f830ef805bea37.tar.gz
llvm-a6ace00520a9df552ecfec6557f830ef805bea37.tar.bz2
llvm-a6ace00520a9df552ecfec6557f830ef805bea37.tar.xz
Make stackmap machineinstrs clobber the scratch regs too.
Patchpoints already did this. Doing it for stackmaps is a convenience for the runtime in the event that it needs to scratch register to patch or perform a runtime call thunk. Unlike patchpoints, we just assume the AnyRegCC calling convention. This is the only language and target independent calling convention specific to stackmaps so makes sense. Although the calling convention is not currently used to select the scratch registers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/InstrEmitter.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
index 856ef34a2a..1c596b8c42 100644
--- a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
+++ b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
@@ -740,10 +740,16 @@ EmitMachineNode(SDNode *Node, bool IsClone, bool IsCloned,
unsigned NumDefs = II.getNumDefs();
const uint16_t *ScratchRegs = NULL;
- // Handle PATCHPOINT specially and then use the generic code.
- if (Opc == TargetOpcode::PATCHPOINT) {
- unsigned CC = Node->getConstantOperandVal(PatchPointOpers::CCPos);
- NumDefs = NumResults;
+ // Handle STACKMAP and PATCHPOINT specially and then use the generic code.
+ if (Opc == TargetOpcode::STACKMAP || Opc == TargetOpcode::PATCHPOINT) {
+ // Stackmaps do not have arguments and do not preserve their calling
+ // convention. However, to simplify runtime support, they clobber the same
+ // scratch registers as AnyRegCC.
+ unsigned CC = CallingConv::AnyReg;
+ if (Opc == TargetOpcode::PATCHPOINT) {
+ CC = Node->getConstantOperandVal(PatchPointOpers::CCPos);
+ NumDefs = NumResults;
+ }
ScratchRegs = TLI->getScratchRegisters((CallingConv::ID) CC);
}