mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
Make debug info come out in data-only files.
This is a question of the debugging setup code not being called at the right time, and it's called from target-dependent code for some reason. I have only attempted to fix Darwin, but I'm pretty sure it's broken elsewhere; I'll leave that to people who can test it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53254 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -42,11 +42,13 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed");
|
|||||||
namespace {
|
namespace {
|
||||||
struct VISIBILITY_HIDDEN ARMAsmPrinter : public AsmPrinter {
|
struct VISIBILITY_HIDDEN ARMAsmPrinter : public AsmPrinter {
|
||||||
ARMAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
|
ARMAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
|
||||||
: AsmPrinter(O, TM, T), DW(O, this, T), AFI(NULL), InCPMode(false) {
|
: AsmPrinter(O, TM, T), DW(O, this, T), MMI(0), AFI(NULL),
|
||||||
|
InCPMode(false) {
|
||||||
Subtarget = &TM.getSubtarget<ARMSubtarget>();
|
Subtarget = &TM.getSubtarget<ARMSubtarget>();
|
||||||
}
|
}
|
||||||
|
|
||||||
DwarfWriter DW;
|
DwarfWriter DW;
|
||||||
|
MachineModuleInfo *MMI;
|
||||||
|
|
||||||
/// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
|
/// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
|
||||||
/// make the right decision when printing asm code for different targets.
|
/// make the right decision when printing asm code for different targets.
|
||||||
@@ -176,8 +178,6 @@ FunctionPass *llvm::createARMCodePrinterPass(std::ostream &o,
|
|||||||
bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||||
AFI = MF.getInfo<ARMFunctionInfo>();
|
AFI = MF.getInfo<ARMFunctionInfo>();
|
||||||
|
|
||||||
DW.SetModuleInfo(&getAnalysis<MachineModuleInfo>());
|
|
||||||
|
|
||||||
SetupMachineFunction(MF);
|
SetupMachineFunction(MF);
|
||||||
O << "\n";
|
O << "\n";
|
||||||
|
|
||||||
@@ -800,6 +800,11 @@ bool ARMAsmPrinter::doInitialization(Module &M) {
|
|||||||
|
|
||||||
bool Result = AsmPrinter::doInitialization(M);
|
bool Result = AsmPrinter::doInitialization(M);
|
||||||
|
|
||||||
|
// AsmPrinter::doInitialization should have done this analysis.
|
||||||
|
MMI = getAnalysisToUpdate<MachineModuleInfo>();
|
||||||
|
assert(MMI);
|
||||||
|
DW.SetModuleInfo(MMI);
|
||||||
|
|
||||||
// Darwin wants symbols to be quoted if they have complex names.
|
// Darwin wants symbols to be quoted if they have complex names.
|
||||||
if (Subtarget->isTargetDarwin())
|
if (Subtarget->isTargetDarwin())
|
||||||
Mang->setUseQuotes(true);
|
Mang->setUseQuotes(true);
|
||||||
|
@@ -790,9 +790,6 @@ std::string DarwinAsmPrinter::getSectionForFunction(const Function &F) const {
|
|||||||
/// method to print assembly for each instruction.
|
/// method to print assembly for each instruction.
|
||||||
///
|
///
|
||||||
bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||||
// We need this for Personality functions.
|
|
||||||
MMI = &getAnalysis<MachineModuleInfo>();
|
|
||||||
DW.SetModuleInfo(MMI);
|
|
||||||
|
|
||||||
SetupMachineFunction(MF);
|
SetupMachineFunction(MF);
|
||||||
O << "\n\n";
|
O << "\n\n";
|
||||||
@@ -887,6 +884,12 @@ bool DarwinAsmPrinter::doInitialization(Module &M) {
|
|||||||
|
|
||||||
bool Result = AsmPrinter::doInitialization(M);
|
bool Result = AsmPrinter::doInitialization(M);
|
||||||
|
|
||||||
|
// We need this for Personality functions.
|
||||||
|
// AsmPrinter::doInitialization should have done this analysis.
|
||||||
|
MMI = getAnalysisToUpdate<MachineModuleInfo>();
|
||||||
|
assert(MMI);
|
||||||
|
DW.SetModuleInfo(MMI);
|
||||||
|
|
||||||
// Darwin wants symbols to be quoted if they have complex names.
|
// Darwin wants symbols to be quoted if they have complex names.
|
||||||
Mang->setUseQuotes(true);
|
Mang->setUseQuotes(true);
|
||||||
|
|
||||||
|
@@ -232,13 +232,6 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
unsigned CC = F->getCallingConv();
|
unsigned CC = F->getCallingConv();
|
||||||
|
|
||||||
if (TAI->doesSupportDebugInformation()) {
|
|
||||||
// Let PassManager know we need debug information and relay
|
|
||||||
// the MachineModuleInfo address on to DwarfWriter.
|
|
||||||
MMI = &getAnalysis<MachineModuleInfo>();
|
|
||||||
DW.SetModuleInfo(MMI);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetupMachineFunction(MF);
|
SetupMachineFunction(MF);
|
||||||
O << "\n\n";
|
O << "\n\n";
|
||||||
|
|
||||||
@@ -751,13 +744,20 @@ void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
|
|||||||
|
|
||||||
/// doInitialization
|
/// doInitialization
|
||||||
bool X86ATTAsmPrinter::doInitialization(Module &M) {
|
bool X86ATTAsmPrinter::doInitialization(Module &M) {
|
||||||
|
|
||||||
|
bool Result = AsmPrinter::doInitialization(M);
|
||||||
|
|
||||||
if (TAI->doesSupportDebugInformation()) {
|
if (TAI->doesSupportDebugInformation()) {
|
||||||
// Emit initial debug information.
|
// Emit initial debug information.
|
||||||
DW.BeginModule(&M);
|
DW.BeginModule(&M);
|
||||||
|
// Let PassManager know we need debug information and relay
|
||||||
|
// the MachineModuleInfo address on to DwarfWriter.
|
||||||
|
// AsmPrinter::doInitialization should have done this analysis.
|
||||||
|
MMI = getAnalysisToUpdate<MachineModuleInfo>();
|
||||||
|
assert(MMI);
|
||||||
|
DW.SetModuleInfo(MMI);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Result = AsmPrinter::doInitialization(M);
|
|
||||||
|
|
||||||
// Darwin wants symbols to be quoted if they have complex names.
|
// Darwin wants symbols to be quoted if they have complex names.
|
||||||
if (Subtarget->isTargetDarwin())
|
if (Subtarget->isTargetDarwin())
|
||||||
Mang->setUseQuotes(true);
|
Mang->setUseQuotes(true);
|
||||||
|
Reference in New Issue
Block a user