forked from OSchip/llvm-project
Add PPC AsmPrinter handling for target-specific form of
DBG_VALUE, and a cautionary comment. llvm-svn: 102371
This commit is contained in:
parent
954daf9aa5
commit
bc41cfa78f
|
@ -367,6 +367,9 @@ public:
|
|||
/// normally be lowered the same way as other addresses on the target,
|
||||
/// e.g. in load instructions. For targets that do not support this
|
||||
/// the debug info is simply lost.
|
||||
/// If you add this for a target you should handle this DBG_VALUE in the
|
||||
/// target-specific AsmPrinter code as well; you will probably get invalid
|
||||
/// assembly output if you don't.
|
||||
virtual MachineInstr *emitFrameIndexDebugValue(MachineFunction &MF,
|
||||
unsigned FrameIx,
|
||||
uint64_t Offset,
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "PPCPredicates.h"
|
||||
#include "PPCTargetMachine.h"
|
||||
#include "PPCSubtarget.h"
|
||||
#include "llvm/Analysis/DebugInfo.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Module.h"
|
||||
|
@ -535,6 +536,23 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||
SmallString<128> Str;
|
||||
raw_svector_ostream O(Str);
|
||||
|
||||
if (MI->getOpcode() == TargetOpcode::DBG_VALUE) {
|
||||
unsigned NOps = MI->getNumOperands();
|
||||
assert(NOps==4);
|
||||
O << '\t' << MAI->getCommentString() << "DEBUG_VALUE: ";
|
||||
// cast away const; DIetc do not take const operands for some reason.
|
||||
DIVariable V(const_cast<MDNode *>(MI->getOperand(NOps-1).getMetadata()));
|
||||
O << V.getName();
|
||||
O << " <- ";
|
||||
// Frame address. Currently handles register +- offset only.
|
||||
assert(MI->getOperand(0).isReg() && MI->getOperand(1).isImm());
|
||||
O << '['; printOperand(MI, 0, O); O << '+'; printOperand(MI, 1, O);
|
||||
O << ']';
|
||||
O << "+";
|
||||
printOperand(MI, NOps-2, O);
|
||||
OutStreamer.EmitRawText(O.str());
|
||||
return;
|
||||
}
|
||||
// Check for slwi/srwi mnemonics.
|
||||
if (MI->getOpcode() == PPC::RLWINM) {
|
||||
unsigned char SH = MI->getOperand(2).getImm();
|
||||
|
|
Loading…
Reference in New Issue