summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2013-11-29 03:07:54 +0000
committerLang Hames <lhames@gmail.com>2013-11-29 03:07:54 +0000
commit1cbca515b6804a24d778fc0cab04ea0c53900141 (patch)
tree4373adbf32f0dd251035a76616dcfcd68b49c6a7 /lib/CodeGen/PrologEpilogInserter.cpp
parent7fd70e7b0c9c12183d9a3b084e5789622d0414fa (diff)
downloadllvm-1cbca515b6804a24d778fc0cab04ea0c53900141.tar.gz
llvm-1cbca515b6804a24d778fc0cab04ea0c53900141.tar.bz2
llvm-1cbca515b6804a24d778fc0cab04ea0c53900141.tar.xz
Refactor a lot of patchpoint/stackmap related code to simplify and make it
target independent. Most of the x86 specific stackmap/patchpoint handling was necessitated by the use of the native address-mode format for frame index operands. PEI has now been modified to treat stackmap/patchpoint similarly to DEBUG_INFO, allowing us to use a simple, platform independent register/offset pair for frame indexes on stackmap/patchpoints. Notes: - Folding is now platform independent and automatically supported. - Emiting patchpoints with direct memory references now just involves calling the TargetLoweringBase::emitPatchPoint utility method from the target's XXXTargetLowering::EmitInstrWithCustomInserter method. (See X86TargetLowering for an example). - No more ugly platform-specific operand parsers. This patch shouldn't change the generated output for X86. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195944 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--lib/CodeGen/PrologEpilogInserter.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp
index b0e494ffcd..0107a9cb44 100644
--- a/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/lib/CodeGen/PrologEpilogInserter.cpp
@@ -731,15 +731,18 @@ void PEI::replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &Fn,
// Frame indicies in debug values are encoded in a target independent
// way with simply the frame index and offset rather than any
// target-specific addressing mode.
- if (MI->isDebugValue()) {
- assert(i == 0 && "Frame indicies can only appear as the first "
- "operand of a DBG_VALUE machine instruction");
+ if (MI->isDebugValue() ||
+ MI->getOpcode() == TargetOpcode::STACKMAP ||
+ MI->getOpcode() == TargetOpcode::PATCHPOINT) {
+ assert((!MI->isDebugValue() || i == 0) &&
+ "Frame indicies can only appear as the first operand of a "
+ "DBG_VALUE machine instruction");
unsigned Reg;
- MachineOperand &Offset = MI->getOperand(1);
+ MachineOperand &Offset = MI->getOperand(i + 1);
Offset.setImm(Offset.getImm() +
TFI->getFrameIndexReference(
- Fn, MI->getOperand(0).getIndex(), Reg));
- MI->getOperand(0).ChangeToRegister(Reg, false /*isDef*/);
+ Fn, MI->getOperand(i).getIndex(), Reg));
+ MI->getOperand(i).ChangeToRegister(Reg, false /*isDef*/);
continue;
}