|
@@ -125,22 +125,19 @@ StackMaps::parseOperand(MachineInstr::const_mop_iterator MOI,
|
|
}
|
|
}
|
|
|
|
|
|
/// Go up the super-register chain until we hit a valid dwarf register number.
|
|
/// Go up the super-register chain until we hit a valid dwarf register number.
|
|
-static unsigned short getDwarfRegNum(unsigned Reg, const MCRegisterInfo &MCRI,
|
|
|
|
- const TargetRegisterInfo *TRI) {
|
|
|
|
- int RegNo = MCRI.getDwarfRegNum(Reg, false);
|
|
|
|
- for (MCSuperRegIterator SR(Reg, TRI);
|
|
|
|
- SR.isValid() && RegNo < 0; ++SR)
|
|
|
|
|
|
+static unsigned 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);
|
|
RegNo = TRI->getDwarfRegNum(*SR, false);
|
|
|
|
|
|
assert(RegNo >= 0 && "Invalid Dwarf register number.");
|
|
assert(RegNo >= 0 && "Invalid Dwarf register number.");
|
|
- return (unsigned short) RegNo;
|
|
|
|
|
|
+ return (unsigned) RegNo;
|
|
}
|
|
}
|
|
|
|
|
|
/// Create a live-out register record for the given register Reg.
|
|
/// Create a live-out register record for the given register Reg.
|
|
StackMaps::LiveOutReg
|
|
StackMaps::LiveOutReg
|
|
-StackMaps::createLiveOutReg(unsigned Reg, const MCRegisterInfo &MCRI,
|
|
|
|
- const TargetRegisterInfo *TRI) const {
|
|
|
|
- unsigned RegNo = getDwarfRegNum(Reg, MCRI, TRI);
|
|
|
|
|
|
+StackMaps::createLiveOutReg(unsigned Reg, const TargetRegisterInfo *TRI) const {
|
|
|
|
+ unsigned RegNo = getDwarfRegNum(Reg, TRI);
|
|
unsigned Size = TRI->getMinimalPhysRegClass(Reg)->getSize();
|
|
unsigned Size = TRI->getMinimalPhysRegClass(Reg)->getSize();
|
|
return LiveOutReg(Reg, RegNo, Size);
|
|
return LiveOutReg(Reg, RegNo, Size);
|
|
}
|
|
}
|
|
@@ -151,14 +148,12 @@ StackMaps::LiveOutVec
|
|
StackMaps::parseRegisterLiveOutMask(const uint32_t *Mask) const {
|
|
StackMaps::parseRegisterLiveOutMask(const uint32_t *Mask) const {
|
|
assert(Mask && "No register mask specified");
|
|
assert(Mask && "No register mask specified");
|
|
const TargetRegisterInfo *TRI = AP.TM.getRegisterInfo();
|
|
const TargetRegisterInfo *TRI = AP.TM.getRegisterInfo();
|
|
- MCContext &OutContext = AP.OutStreamer.getContext();
|
|
|
|
- const MCRegisterInfo &MCRI = *OutContext.getRegisterInfo();
|
|
|
|
LiveOutVec LiveOuts;
|
|
LiveOutVec LiveOuts;
|
|
|
|
|
|
// Create a LiveOutReg for each bit that is set in the register mask.
|
|
// Create a LiveOutReg for each bit that is set in the register mask.
|
|
for (unsigned Reg = 0, NumRegs = TRI->getNumRegs(); Reg != NumRegs; ++Reg)
|
|
for (unsigned Reg = 0, NumRegs = TRI->getNumRegs(); Reg != NumRegs; ++Reg)
|
|
if ((Mask[Reg / 32] >> Reg % 32) & 1)
|
|
if ((Mask[Reg / 32] >> Reg % 32) & 1)
|
|
- LiveOuts.push_back(createLiveOutReg(Reg, MCRI, TRI));
|
|
|
|
|
|
+ LiveOuts.push_back(createLiveOutReg(Reg, TRI));
|
|
|
|
|
|
// We don't need to keep track of a register if its super-register is already
|
|
// 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
|
|
// in the list. Merge entries that refer to the same dwarf register and use
|
|
@@ -320,7 +315,6 @@ void StackMaps::serializeToStackMapSection() {
|
|
// Serialize data.
|
|
// Serialize data.
|
|
const char *WSMP = "Stack Maps: ";
|
|
const char *WSMP = "Stack Maps: ";
|
|
(void)WSMP;
|
|
(void)WSMP;
|
|
- const MCRegisterInfo &MCRI = *OutContext.getRegisterInfo();
|
|
|
|
|
|
|
|
DEBUG(dbgs() << "********** Stack Map Output **********\n");
|
|
DEBUG(dbgs() << "********** Stack Map Output **********\n");
|
|
|
|
|
|
@@ -387,19 +381,16 @@ void StackMaps::serializeToStackMapSection() {
|
|
unsigned RegNo = 0;
|
|
unsigned RegNo = 0;
|
|
int Offset = Loc.Offset;
|
|
int Offset = Loc.Offset;
|
|
if(Loc.Reg) {
|
|
if(Loc.Reg) {
|
|
- RegNo = MCRI.getDwarfRegNum(Loc.Reg, false);
|
|
|
|
- for (MCSuperRegIterator SR(Loc.Reg, TRI);
|
|
|
|
- SR.isValid() && (int)RegNo < 0; ++SR) {
|
|
|
|
- RegNo = TRI->getDwarfRegNum(*SR, false);
|
|
|
|
- }
|
|
|
|
|
|
+ RegNo = getDwarfRegNum(Loc.Reg, TRI);
|
|
|
|
+
|
|
// If this is a register location, put the subregister byte offset in
|
|
// If this is a register location, put the subregister byte offset in
|
|
// the location offset.
|
|
// the location offset.
|
|
if (Loc.LocType == Location::Register) {
|
|
if (Loc.LocType == Location::Register) {
|
|
assert(!Loc.Offset && "Register location should have zero offset");
|
|
assert(!Loc.Offset && "Register location should have zero offset");
|
|
- unsigned LLVMRegNo = MCRI.getLLVMRegNum(RegNo, false);
|
|
|
|
- unsigned SubRegIdx = MCRI.getSubRegIndex(LLVMRegNo, Loc.Reg);
|
|
|
|
|
|
+ unsigned LLVMRegNo = TRI->getLLVMRegNum(RegNo, false);
|
|
|
|
+ unsigned SubRegIdx = TRI->getSubRegIndex(LLVMRegNo, Loc.Reg);
|
|
if (SubRegIdx)
|
|
if (SubRegIdx)
|
|
- Offset = MCRI.getSubRegIdxOffset(SubRegIdx);
|
|
|
|
|
|
+ Offset = TRI->getSubRegIdxOffset(SubRegIdx);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -414,15 +405,15 @@ void StackMaps::serializeToStackMapSection() {
|
|
dbgs() << "<Unprocessed operand>";
|
|
dbgs() << "<Unprocessed operand>";
|
|
break;
|
|
break;
|
|
case Location::Register:
|
|
case Location::Register:
|
|
- dbgs() << "Register " << MCRI.getName(Loc.Reg);
|
|
|
|
|
|
+ dbgs() << "Register " << TRI->getName(Loc.Reg);
|
|
break;
|
|
break;
|
|
case Location::Direct:
|
|
case Location::Direct:
|
|
- dbgs() << "Direct " << MCRI.getName(Loc.Reg);
|
|
|
|
|
|
+ dbgs() << "Direct " << TRI->getName(Loc.Reg);
|
|
if (Loc.Offset)
|
|
if (Loc.Offset)
|
|
dbgs() << " + " << Loc.Offset;
|
|
dbgs() << " + " << Loc.Offset;
|
|
break;
|
|
break;
|
|
case Location::Indirect:
|
|
case Location::Indirect:
|
|
- dbgs() << "Indirect " << MCRI.getName(Loc.Reg)
|
|
|
|
|
|
+ dbgs() << "Indirect " << TRI->getName(Loc.Reg)
|
|
<< " + " << Loc.Offset;
|
|
<< " + " << Loc.Offset;
|
|
break;
|
|
break;
|
|
case Location::Constant:
|
|
case Location::Constant:
|
|
@@ -453,7 +444,7 @@ void StackMaps::serializeToStackMapSection() {
|
|
for (LiveOutVec::const_iterator LI = LiveOuts.begin(), LE = LiveOuts.end();
|
|
for (LiveOutVec::const_iterator LI = LiveOuts.begin(), LE = LiveOuts.end();
|
|
LI != LE; ++LI, ++operIdx) {
|
|
LI != LE; ++LI, ++operIdx) {
|
|
DEBUG(dbgs() << WSMP << " LO " << operIdx << ": "
|
|
DEBUG(dbgs() << WSMP << " LO " << operIdx << ": "
|
|
- << MCRI.getName(LI->Reg)
|
|
|
|
|
|
+ << TRI->getName(LI->Reg)
|
|
<< " [encoding: .short " << LI->RegNo
|
|
<< " [encoding: .short " << LI->RegNo
|
|
<< ", .byte 0, .byte " << LI->Size << "]\n");
|
|
<< ", .byte 0, .byte " << LI->Size << "]\n");
|
|
|
|
|