Commit c6d65967 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add some more patchpoint-related llvm patches

parent d3657206
From d29f41a06219e5e9176722a9960caee3399ab104 Mon Sep 17 00:00:00 2001
From: Kevin Modzelewski <kevmod@gmail.com>
Date: Mon, 13 Oct 2014 16:16:17 -0700
Subject: [PATCH] Filter out extraneous registers from live outs, like eflags and rip
---
lib/CodeGen/StackMaps.cpp | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/lib/CodeGen/StackMaps.cpp b/lib/CodeGen/StackMaps.cpp
index a32a7c1..e5f84a1 100644
--- a/lib/CodeGen/StackMaps.cpp
+++ b/lib/CodeGen/StackMaps.cpp
@@ -139,19 +139,19 @@ StackMaps::parseOperand(MachineInstr::const_mop_iterator MOI,
}
/// Go up the super-register chain until we hit a valid dwarf register number.
-static unsigned getDwarfRegNum(unsigned Reg, const TargetRegisterInfo *TRI) {
+static int getDwarfRegNum(unsigned Reg, const TargetRegisterInfo *TRI) {
int RegNo = TRI->getDwarfRegNum(Reg, false);
for (MCSuperRegIterator SR(Reg, TRI); SR.isValid() && RegNo < 0; ++SR)
RegNo = TRI->getDwarfRegNum(*SR, false);
- assert(RegNo >= 0 && "Invalid Dwarf register number.");
- return (unsigned) RegNo;
+ return (int) RegNo;
}
/// Create a live-out register record for the given register Reg.
StackMaps::LiveOutReg
StackMaps::createLiveOutReg(unsigned Reg, const TargetRegisterInfo *TRI) const {
- unsigned RegNo = getDwarfRegNum(Reg, TRI);
+ int RegNo = getDwarfRegNum(Reg, TRI);
+ assert(RegNo >= 0 && "Invalid Dwarf register number.");
unsigned Size = TRI->getMinimalPhysRegClass(Reg)->getSize();
return LiveOutReg(Reg, RegNo, Size);
}
@@ -165,9 +165,16 @@ StackMaps::parseRegisterLiveOutMask(const uint32_t *Mask) const {
LiveOutVec LiveOuts;
// Create a LiveOutReg for each bit that is set in the register mask.
- for (unsigned Reg = 0, NumRegs = TRI->getNumRegs(); Reg != NumRegs; ++Reg)
- if ((Mask[Reg / 32] >> Reg % 32) & 1)
+ for (unsigned Reg = 0, NumRegs = TRI->getNumRegs(); Reg != NumRegs; ++Reg) {
+ if ((Mask[Reg / 32] >> Reg % 32) & 1) {
+ int RegNo = getDwarfRegNum(Reg, TRI);
+ if (RegNo < 0)
+ continue;
+ if (!TRI->isInAllocatableClass(Reg))
+ continue;
LiveOuts.push_back(createLiveOutReg(Reg, TRI));
+ }
+ }
// We don't need to keep track of a register if its super-register is already
// in the list. Merge entries that refer to the same dwarf register and use
@@ -400,10 +407,11 @@ void StackMaps::emitCallsiteEntries(MCStreamer &OS,
unsigned OperIdx = 0;
for (const auto &Loc : CSLocs) {
- unsigned RegNo = 0;
+ int RegNo = 0;
int Offset = Loc.Offset;
if(Loc.Reg) {
RegNo = getDwarfRegNum(Loc.Reg, TRI);
+ assert(RegNo >= 0 && "Invalid Dwarf register number.");
// If this is a register location, put the subregister byte offset in
// the location offset.
--
1.7.4.1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment