mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
- Use the "Fast" flag instead of "OptimizeForSize" to determine whether to emit
a DBG_LABEL or not. We want to fall back to the original way of emitting debug info when we're in -O0/-fast mode. - Add plumbing in to pass the "Fast" flag to places that need it. - XFAIL DebugInfo/deaddebuglabel.ll. This is finding 11 labels instead of 8. I need to investigate still. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65367 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
85937de26b
commit
5aa4977fba
@ -48,7 +48,10 @@ private:
|
|||||||
/// DE - Provides the DwarfWriter exception implementation.
|
/// DE - Provides the DwarfWriter exception implementation.
|
||||||
///
|
///
|
||||||
DwarfException *DE;
|
DwarfException *DE;
|
||||||
|
|
||||||
|
/// FastCodeGen - True if generating code via the "fast" isel.
|
||||||
|
///
|
||||||
|
bool FastCodeGen;
|
||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
|
|
||||||
@ -104,6 +107,9 @@ public:
|
|||||||
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
|
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
|
||||||
/// be emitted.
|
/// be emitted.
|
||||||
bool ShouldEmitDwarfDebug() const;
|
bool ShouldEmitDwarfDebug() const;
|
||||||
|
|
||||||
|
bool getFastCodeGen() const { return FastCodeGen; }
|
||||||
|
void setFastCodeGen(bool Fast) { FastCodeGen = Fast; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// Note that this is an involved process that may invalidate pointers into
|
/// Note that this is an involved process that may invalidate pointers into
|
||||||
/// the graph.
|
/// the graph.
|
||||||
void Legalize(bool TypesNeedLegalizing);
|
void Legalize(bool TypesNeedLegalizing, bool Fast);
|
||||||
|
|
||||||
/// RemoveDeadNodes - This method deletes all unreachable nodes in the
|
/// RemoveDeadNodes - This method deletes all unreachable nodes in the
|
||||||
/// SelectionDAG.
|
/// SelectionDAG.
|
||||||
|
@ -370,6 +370,7 @@ bool FastISel::SelectCall(User *I) {
|
|||||||
unsigned Line = Subprogram.getLineNumber();
|
unsigned Line = Subprogram.getLineNumber();
|
||||||
unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile);
|
unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile);
|
||||||
setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
|
setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
|
||||||
|
DW->setFastCodeGen(true);
|
||||||
|
|
||||||
if (DW->getRecordSourceLineCount() != 1) {
|
if (DW->getRecordSourceLineCount() != 1) {
|
||||||
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
|
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
|
||||||
|
@ -56,6 +56,7 @@ class VISIBILITY_HIDDEN SelectionDAGLegalize {
|
|||||||
TargetLowering &TLI;
|
TargetLowering &TLI;
|
||||||
SelectionDAG &DAG;
|
SelectionDAG &DAG;
|
||||||
bool TypesNeedLegalizing;
|
bool TypesNeedLegalizing;
|
||||||
|
bool Fast;
|
||||||
|
|
||||||
// Libcall insertion helpers.
|
// Libcall insertion helpers.
|
||||||
|
|
||||||
@ -137,7 +138,8 @@ class VISIBILITY_HIDDEN SelectionDAGLegalize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SelectionDAGLegalize(SelectionDAG &DAG, bool TypesNeedLegalizing);
|
explicit SelectionDAGLegalize(SelectionDAG &DAG, bool TypesNeedLegalizing,
|
||||||
|
bool fast);
|
||||||
|
|
||||||
/// getTypeAction - Return how we should legalize values of this type, either
|
/// getTypeAction - Return how we should legalize values of this type, either
|
||||||
/// it is already legal or we need to expand it into multiple registers of
|
/// it is already legal or we need to expand it into multiple registers of
|
||||||
@ -362,9 +364,10 @@ SDNode *SelectionDAGLegalize::isShuffleLegal(MVT VT, SDValue Mask) const {
|
|||||||
return TLI.isShuffleMaskLegal(Mask, VT) ? Mask.getNode() : 0;
|
return TLI.isShuffleMaskLegal(Mask, VT) ? Mask.getNode() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag, bool types)
|
SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag,
|
||||||
|
bool types, bool fast)
|
||||||
: TLI(dag.getTargetLoweringInfo()), DAG(dag), TypesNeedLegalizing(types),
|
: TLI(dag.getTargetLoweringInfo()), DAG(dag), TypesNeedLegalizing(types),
|
||||||
ValueTypeActions(TLI.getValueTypeActions()) {
|
Fast(fast), ValueTypeActions(TLI.getValueTypeActions()) {
|
||||||
assert(MVT::LAST_VALUETYPE <= 32 &&
|
assert(MVT::LAST_VALUETYPE <= 32 &&
|
||||||
"Too many value types for ValueTypeActions to hold!");
|
"Too many value types for ValueTypeActions to hold!");
|
||||||
}
|
}
|
||||||
@ -1289,9 +1292,8 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
|||||||
|
|
||||||
unsigned Line = DSP->getLine();
|
unsigned Line = DSP->getLine();
|
||||||
unsigned Col = DSP->getColumn();
|
unsigned Col = DSP->getColumn();
|
||||||
const Function *F = DAG.getMachineFunction().getFunction();
|
|
||||||
|
|
||||||
if (!F->hasFnAttr(Attribute::OptimizeForSize)) {
|
if (Fast) {
|
||||||
// A bit self-referential to have DebugLoc on Debug_Loc nodes, but it
|
// A bit self-referential to have DebugLoc on Debug_Loc nodes, but it
|
||||||
// won't hurt anything.
|
// won't hurt anything.
|
||||||
if (useDEBUG_LOC) {
|
if (useDEBUG_LOC) {
|
||||||
@ -8640,9 +8642,9 @@ SDValue SelectionDAGLegalize::StoreWidenVectorOp(StoreSDNode *ST,
|
|||||||
|
|
||||||
// SelectionDAG::Legalize - This is the entry point for the file.
|
// SelectionDAG::Legalize - This is the entry point for the file.
|
||||||
//
|
//
|
||||||
void SelectionDAG::Legalize(bool TypesNeedLegalizing) {
|
void SelectionDAG::Legalize(bool TypesNeedLegalizing, bool Fast) {
|
||||||
/// run - This is the main entry point to this class.
|
/// run - This is the main entry point to this class.
|
||||||
///
|
///
|
||||||
SelectionDAGLegalize(*this, TypesNeedLegalizing).LegalizeDAG();
|
SelectionDAGLegalize(*this, TypesNeedLegalizing, Fast).LegalizeDAG();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3915,6 +3915,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
if (Fast)
|
if (Fast)
|
||||||
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
||||||
getRoot(), LabelID));
|
getRoot(), LabelID));
|
||||||
|
DW->setFastCodeGen(Fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -3950,9 +3951,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
// create a label if this is a beginning of inlined function.
|
// create a label if this is a beginning of inlined function.
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
unsigned Line = Subprogram.getLineNumber();
|
||||||
|
|
||||||
// FIXME: Support more than just -Os.
|
if (Fast) {
|
||||||
const Function *F = I.getParent()->getParent();
|
|
||||||
if (!F->hasFnAttr(Attribute::OptimizeForSize)) {
|
|
||||||
unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile);
|
unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile);
|
||||||
if (DW->getRecordSourceLineCount() != 1)
|
if (DW->getRecordSourceLineCount() != 1)
|
||||||
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
||||||
@ -3966,8 +3965,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case Intrinsic::dbg_declare: {
|
case Intrinsic::dbg_declare: {
|
||||||
const Function *F = I.getParent()->getParent();
|
if (Fast) {
|
||||||
if (!F->hasFnAttr(Attribute::OptimizeForSize)) {
|
|
||||||
DwarfWriter *DW = DAG.getDwarfWriter();
|
DwarfWriter *DW = DAG.getDwarfWriter();
|
||||||
DbgDeclareInst &DI = cast<DbgDeclareInst>(I);
|
DbgDeclareInst &DI = cast<DbgDeclareInst>(I);
|
||||||
Value *Variable = DI.getVariable();
|
Value *Variable = DI.getVariable();
|
||||||
|
@ -621,9 +621,9 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
|
|
||||||
if (TimePassesIsEnabled) {
|
if (TimePassesIsEnabled) {
|
||||||
NamedRegionTimer T("DAG Legalization", GroupName);
|
NamedRegionTimer T("DAG Legalization", GroupName);
|
||||||
CurDAG->Legalize(DisableLegalizeTypes);
|
CurDAG->Legalize(DisableLegalizeTypes, Fast);
|
||||||
} else {
|
} else {
|
||||||
CurDAG->Legalize(DisableLegalizeTypes);
|
CurDAG->Legalize(DisableLegalizeTypes, Fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
DOUT << "Legalized selection DAG:\n";
|
DOUT << "Legalized selection DAG:\n";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
; RUN: llvm-as < %s | llc | grep "\\"foo" | count 3
|
; RUN: llvm-as < %s | llc -fast | grep "\\"foo" | count 3
|
||||||
; 1 declaration, 1 definition and 1 pubnames entry.
|
; 1 declaration, 1 definition and 1 pubnames entry.
|
||||||
target triple = "i386-apple-darwin*"
|
target triple = "i386-apple-darwin*"
|
||||||
%llvm.dbg.anchor.type = type { i32, i32 }
|
%llvm.dbg.anchor.type = type { i32, i32 }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
; RUN: llvm-as < %s | llc -fast | grep "label" | count 8
|
||||||
; PR2614
|
; PR2614
|
||||||
; RUN: llvm-as < %s | llc | grep "label" | count 8
|
; XFAIL: *
|
||||||
|
|
||||||
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-f80:32:32-v64:64:64-v128:128:128-a0:0:64"
|
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-f80:32:32-v64:64:64-v128:128:128-a0:0:64"
|
||||||
target triple = "i686-pc-linux-gnu"
|
target triple = "i686-pc-linux-gnu"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
; RUN: llvm-as < %s | llc | %prcontext ST 1 | grep 0x1 | count 1
|
; RUN: llvm-as < %s | llc -fast | %prcontext ST 1 | grep 0x1 | count 1
|
||||||
|
|
||||||
target triple = "i386-apple-darwin9.6"
|
target triple = "i386-apple-darwin9.6"
|
||||||
%llvm.dbg.anchor.type = type { i32, i32 }
|
%llvm.dbg.anchor.type = type { i32, i32 }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// This is a regression test on debug info to make sure that we can get a
|
// This is a regression test on debug info to make sure that we can get a
|
||||||
// meaningful stack trace from a C++ program.
|
// meaningful stack trace from a C++ program.
|
||||||
// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp-elim -o %t.s -f
|
// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \
|
||||||
|
// RUN: llc --disable-fp-elim -o %t.s -f -fast -relocation-model=pic
|
||||||
// RUN: %compile_c %t.s -o %t.o
|
// RUN: %compile_c %t.s -o %t.o
|
||||||
// RUN: %link %t.o -o %t.exe
|
// RUN: %link %t.o -o %t.exe
|
||||||
// RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in
|
// RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// This is a regression test on debug info to make sure that we can access
|
// This is a regression test on debug info to make sure that we can access
|
||||||
// qualified global names.
|
// qualified global names.
|
||||||
// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \
|
// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \
|
||||||
// RUN: llc --disable-fp-elim -o %t.s -f
|
// RUN: llc --disable-fp-elim -o %t.s -f -fast
|
||||||
// RUN: %compile_c %t.s -o %t.o
|
// RUN: %compile_c %t.s -o %t.o
|
||||||
// RUN: %link %t.o -o %t.exe
|
// RUN: %link %t.o -o %t.exe
|
||||||
// RUN: %llvmdsymutil %t.exe
|
// RUN: %llvmdsymutil %t.exe
|
||||||
|
@ -641,7 +641,8 @@ void AsmWriterEmitter::run(std::ostream &O) {
|
|||||||
O << "\";\n\n";
|
O << "\";\n\n";
|
||||||
|
|
||||||
O << " if (TAI->doesSupportDebugInformation() &&\n"
|
O << " if (TAI->doesSupportDebugInformation() &&\n"
|
||||||
<< " DW->ShouldEmitDwarfDebug()) {\n"
|
<< " DW->ShouldEmitDwarfDebug() &&\n"
|
||||||
|
<< " !DW->getFastCodeGen()) {\n"
|
||||||
<< " const MachineFunction *MF = MI->getParent()->getParent();\n"
|
<< " const MachineFunction *MF = MI->getParent()->getParent();\n"
|
||||||
<< " DebugLoc CurDL = MI->getDebugLoc();\n\n"
|
<< " DebugLoc CurDL = MI->getDebugLoc();\n\n"
|
||||||
<< " if (!CurDL.isUnknown()) {\n"
|
<< " if (!CurDL.isUnknown()) {\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user