mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-18 14:31:27 +00:00
move two asmprinter methods into the asmprinter .cpp file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108945 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6a0dc079ef
commit
1a34c83caf
@ -24,6 +24,7 @@
|
|||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
|
#include "llvm/Analysis/DebugInfo.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include "llvm/MC/MCAsmInfo.h"
|
#include "llvm/MC/MCAsmInfo.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
@ -659,6 +660,44 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MachineLocation
|
||||||
|
X86AsmPrinter::getDebugValueLocation(const MachineInstr *MI) const {
|
||||||
|
MachineLocation Location;
|
||||||
|
assert (MI->getNumOperands() == 7 && "Invalid no. of machine operands!");
|
||||||
|
// Frame address. Currently handles register +- offset only.
|
||||||
|
|
||||||
|
if (MI->getOperand(0).isReg() && MI->getOperand(3).isImm())
|
||||||
|
Location.set(MI->getOperand(0).getReg(), MI->getOperand(3).getImm());
|
||||||
|
return Location;
|
||||||
|
}
|
||||||
|
|
||||||
|
void X86AsmPrinter::PrintDebugValueComment(const MachineInstr *MI,
|
||||||
|
raw_ostream &O) {
|
||||||
|
// Only the target-dependent form of DBG_VALUE should get here.
|
||||||
|
// Referencing the offset and metadata as NOps-2 and NOps-1 is
|
||||||
|
// probably portable to other targets; frame pointer location is not.
|
||||||
|
unsigned NOps = MI->getNumOperands();
|
||||||
|
assert(NOps==7);
|
||||||
|
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()));
|
||||||
|
if (V.getContext().isSubprogram())
|
||||||
|
O << DISubprogram(V.getContext()).getDisplayName() << ":";
|
||||||
|
O << V.getName();
|
||||||
|
O << " <- ";
|
||||||
|
// Frame address. Currently handles register +- offset only.
|
||||||
|
O << '[';
|
||||||
|
if (MI->getOperand(0).isReg() && MI->getOperand(0).getReg())
|
||||||
|
printOperand(MI, 0, O);
|
||||||
|
else
|
||||||
|
O << "undef";
|
||||||
|
O << '+'; printOperand(MI, 3, O);
|
||||||
|
O << ']';
|
||||||
|
O << "+";
|
||||||
|
printOperand(MI, NOps-2, O);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Target Registry Stuff
|
// Target Registry Stuff
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "X86AsmPrinter.h"
|
#include "X86AsmPrinter.h"
|
||||||
#include "X86COFFMachineModuleInfo.h"
|
#include "X86COFFMachineModuleInfo.h"
|
||||||
#include "X86MCAsmInfo.h"
|
#include "X86MCAsmInfo.h"
|
||||||
#include "llvm/Analysis/DebugInfo.h"
|
|
||||||
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
|
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
#include "llvm/MC/MCExpr.h"
|
#include "llvm/MC/MCExpr.h"
|
||||||
@ -505,43 +504,6 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void X86AsmPrinter::PrintDebugValueComment(const MachineInstr *MI,
|
|
||||||
raw_ostream &O) {
|
|
||||||
// Only the target-dependent form of DBG_VALUE should get here.
|
|
||||||
// Referencing the offset and metadata as NOps-2 and NOps-1 is
|
|
||||||
// probably portable to other targets; frame pointer location is not.
|
|
||||||
unsigned NOps = MI->getNumOperands();
|
|
||||||
assert(NOps==7);
|
|
||||||
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()));
|
|
||||||
if (V.getContext().isSubprogram())
|
|
||||||
O << DISubprogram(V.getContext()).getDisplayName() << ":";
|
|
||||||
O << V.getName();
|
|
||||||
O << " <- ";
|
|
||||||
// Frame address. Currently handles register +- offset only.
|
|
||||||
O << '[';
|
|
||||||
if (MI->getOperand(0).isReg() && MI->getOperand(0).getReg())
|
|
||||||
printOperand(MI, 0, O);
|
|
||||||
else
|
|
||||||
O << "undef";
|
|
||||||
O << '+'; printOperand(MI, 3, O);
|
|
||||||
O << ']';
|
|
||||||
O << "+";
|
|
||||||
printOperand(MI, NOps-2, O);
|
|
||||||
}
|
|
||||||
|
|
||||||
MachineLocation
|
|
||||||
X86AsmPrinter::getDebugValueLocation(const MachineInstr *MI) const {
|
|
||||||
MachineLocation Location;
|
|
||||||
assert (MI->getNumOperands() == 7 && "Invalid no. of machine operands!");
|
|
||||||
// Frame address. Currently handles register +- offset only.
|
|
||||||
|
|
||||||
if (MI->getOperand(0).isReg() && MI->getOperand(3).isImm())
|
|
||||||
Location.set(MI->getOperand(0).getReg(), MI->getOperand(3).getImm());
|
|
||||||
return Location;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||||
X86MCInstLower MCInstLowering(OutContext, Mang, *this);
|
X86MCInstLower MCInstLowering(OutContext, Mang, *this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user