[llvm] r361604 - [ARM] ARMExpandPseudoInsts: add debug messages
Sjoerd Meijer via llvm-commits
llvm-commits at lists.llvm.org
Fri May 24 01:25:02 PDT 2019
Author: sjoerdmeijer
Date: Fri May 24 01:25:02 2019
New Revision: 361604
URL: http://llvm.org/viewvc/llvm-project?rev=361604&view=rev
Log:
[ARM] ARMExpandPseudoInsts: add debug messages
This pass wasn't printing any messages at all, which I find really inconvenient
while debugging/tracing things. It now dumps the before and after of expanded
instructions. It doesn't do this yet for all instructions, but this is a good
start I guess.
Differential Revision: https://reviews.llvm.org/D62297
Modified:
llvm/trunk/lib/Target/ARM/ARMExpandPseudoInsts.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMExpandPseudoInsts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMExpandPseudoInsts.cpp?rev=361604&r1=361603&r2=361604&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMExpandPseudoInsts.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMExpandPseudoInsts.cpp Fri May 24 01:25:02 2019
@@ -23,6 +23,7 @@
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/Debug.h"
using namespace llvm;
@@ -469,6 +470,7 @@ static void GetDSubRegs(unsigned Reg, NE
void ARMExpandPseudo::ExpandVLD(MachineBasicBlock::iterator &MBBI) {
MachineInstr &MI = *MBBI;
MachineBasicBlock &MBB = *MI.getParent();
+ LLVM_DEBUG(dbgs() << "Expanding: "; MI.dump());
const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
assert(TableEntry && TableEntry->IsLoad && "NEONLdStTable lookup failed");
@@ -570,8 +572,8 @@ void ARMExpandPseudo::ExpandVLD(MachineB
// Transfer memoperands.
MIB.cloneMemRefs(MI);
-
MI.eraseFromParent();
+ LLVM_DEBUG(dbgs() << "To: "; MIB.getInstr()->dump(););
}
/// ExpandVST - Translate VST pseudo instructions with Q, QQ or QQQQ register
@@ -579,6 +581,7 @@ void ARMExpandPseudo::ExpandVLD(MachineB
void ARMExpandPseudo::ExpandVST(MachineBasicBlock::iterator &MBBI) {
MachineInstr &MI = *MBBI;
MachineBasicBlock &MBB = *MI.getParent();
+ LLVM_DEBUG(dbgs() << "Expanding: "; MI.dump());
const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
assert(TableEntry && !TableEntry->IsLoad && "NEONLdStTable lookup failed");
@@ -645,8 +648,8 @@ void ARMExpandPseudo::ExpandVST(MachineB
// Transfer memoperands.
MIB.cloneMemRefs(MI);
-
MI.eraseFromParent();
+ LLVM_DEBUG(dbgs() << "To: "; MIB.getInstr()->dump(););
}
/// ExpandLaneOp - Translate VLD*LN and VST*LN instructions with Q, QQ or QQQQ
@@ -654,6 +657,7 @@ void ARMExpandPseudo::ExpandVST(MachineB
void ARMExpandPseudo::ExpandLaneOp(MachineBasicBlock::iterator &MBBI) {
MachineInstr &MI = *MBBI;
MachineBasicBlock &MBB = *MI.getParent();
+ LLVM_DEBUG(dbgs() << "Expanding: "; MI.dump());
const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
assert(TableEntry && "NEONLdStTable lookup failed");
@@ -744,6 +748,7 @@ void ARMExpandPseudo::ExpandVTBL(Machine
unsigned Opc, bool IsExt) {
MachineInstr &MI = *MBBI;
MachineBasicBlock &MBB = *MI.getParent();
+ LLVM_DEBUG(dbgs() << "Expanding: "; MI.dump());
MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc));
unsigned OpIdx = 0;
@@ -773,6 +778,7 @@ void ARMExpandPseudo::ExpandVTBL(Machine
MIB.addReg(SrcReg, RegState::Implicit | getKillRegState(SrcIsKill));
TransferImpOps(MI, MIB, MIB);
MI.eraseFromParent();
+ LLVM_DEBUG(dbgs() << "To: "; MIB.getInstr()->dump(););
}
static bool IsAnAddressOperand(const MachineOperand &MO) {
@@ -829,6 +835,7 @@ void ARMExpandPseudo::ExpandMOV32BitImm(
const MachineOperand &MO = MI.getOperand(isCC ? 2 : 1);
bool RequiresBundling = STI->isTargetWindows() && IsAnAddressOperand(MO);
MachineInstrBuilder LO16, HI16;
+ LLVM_DEBUG(dbgs() << "Expanding: "; MI.dump());
if (!STI->hasV6T2Ops() &&
(Opcode == ARM::MOVi32imm || Opcode == ARM::MOVCCi32imm)) {
@@ -910,6 +917,8 @@ void ARMExpandPseudo::ExpandMOV32BitImm(
LO16.add(makeImplicit(MI.getOperand(1)));
TransferImpOps(MI, LO16, HI16);
MI.eraseFromParent();
+ LLVM_DEBUG(dbgs() << "To: "; LO16.getInstr()->dump(););
+ LLVM_DEBUG(dbgs() << "And: "; HI16.getInstr()->dump(););
}
/// Expand a CMP_SWAP pseudo-inst to an ldrex/strex loop as simply as
@@ -1929,11 +1938,16 @@ bool ARMExpandPseudo::runOnMachineFuncti
TRI = STI->getRegisterInfo();
AFI = MF.getInfo<ARMFunctionInfo>();
+ LLVM_DEBUG(dbgs() << "********** ARM EXPAND PSEUDO INSTRUCTIONS **********\n"
+ << "********** Function: " << MF.getName() << '\n');
+
bool Modified = false;
for (MachineBasicBlock &MBB : MF)
Modified |= ExpandMBB(MBB);
if (VerifyARMPseudo)
MF.verify(this, "After expanding ARM pseudo instructions.");
+
+ LLVM_DEBUG(dbgs() << "***************************************************\n");
return Modified;
}
More information about the llvm-commits
mailing list