fastisel doesn't need DwarfWriter, remove some tendricles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100381 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-04-05 02:19:28 +00:00
parent cb86609421
commit d850ac79b5
11 changed files with 34 additions and 36 deletions

View File

@@ -28,7 +28,6 @@ class MachineConstantPool;
class MachineFunction; class MachineFunction;
class MachineFrameInfo; class MachineFrameInfo;
class MachineModuleInfo; class MachineModuleInfo;
class DwarfWriter;
class MachineRegisterInfo; class MachineRegisterInfo;
class TargetData; class TargetData;
class TargetInstrInfo; class TargetInstrInfo;
@@ -51,7 +50,6 @@ protected:
#endif #endif
MachineFunction &MF; MachineFunction &MF;
MachineModuleInfo *MMI; MachineModuleInfo *MMI;
DwarfWriter *DW;
MachineRegisterInfo &MRI; MachineRegisterInfo &MRI;
MachineFrameInfo &MFI; MachineFrameInfo &MFI;
MachineConstantPool &MCP; MachineConstantPool &MCP;
@@ -117,7 +115,6 @@ public:
protected: protected:
FastISel(MachineFunction &mf, FastISel(MachineFunction &mf,
MachineModuleInfo *mmi, MachineModuleInfo *mmi,
DwarfWriter *dw,
DenseMap<const Value *, unsigned> &vm, DenseMap<const Value *, unsigned> &vm,
DenseMap<const BasicBlock *, MachineBasicBlock *> &bm, DenseMap<const BasicBlock *, MachineBasicBlock *> &bm,
DenseMap<const AllocaInst *, int> &am DenseMap<const AllocaInst *, int> &am

View File

@@ -30,7 +30,6 @@ namespace llvm {
class MachineFunction; class MachineFunction;
class MachineInstr; class MachineInstr;
class MachineModuleInfo; class MachineModuleInfo;
class DwarfWriter;
class TargetLowering; class TargetLowering;
class TargetInstrInfo; class TargetInstrInfo;
class FunctionLoweringInfo; class FunctionLoweringInfo;
@@ -285,7 +284,6 @@ private:
void SelectAllBasicBlocks(Function &Fn, MachineFunction &MF, void SelectAllBasicBlocks(Function &Fn, MachineFunction &MF,
MachineModuleInfo *MMI, MachineModuleInfo *MMI,
DwarfWriter *DW,
const TargetInstrInfo &TII); const TargetInstrInfo &TII);
void FinishBasicBlock(); void FinishBasicBlock();

View File

@@ -50,7 +50,6 @@ namespace llvm {
class MachineModuleInfo; class MachineModuleInfo;
class MCContext; class MCContext;
class MCExpr; class MCExpr;
class DwarfWriter;
class SDNode; class SDNode;
class SDValue; class SDValue;
class SelectionDAG; class SelectionDAG;
@@ -1273,8 +1272,7 @@ public:
/// createFastISel - This method returns a target specific FastISel object, /// createFastISel - This method returns a target specific FastISel object,
/// or null if the target does not support "fast" ISel. /// or null if the target does not support "fast" ISel.
virtual FastISel * virtual FastISel *
createFastISel(MachineFunction &, createFastISel(MachineFunction &, MachineModuleInfo *,
MachineModuleInfo *, DwarfWriter *,
DenseMap<const Value *, unsigned> &, DenseMap<const Value *, unsigned> &,
DenseMap<const BasicBlock *, MachineBasicBlock *> &, DenseMap<const BasicBlock *, MachineBasicBlock *> &,
DenseMap<const AllocaInst *, int> & DenseMap<const AllocaInst *, int> &

View File

@@ -1793,24 +1793,39 @@ void DwarfDebug::constructSubprogramDIE(MDNode *N) {
void DwarfDebug::beginModule(Module *M) { void DwarfDebug::beginModule(Module *M) {
if (!Asm->MAI->doesSupportDebugInformation()) if (!Asm->MAI->doesSupportDebugInformation())
return; return;
MMI = Asm->MMI;
TimeRegion Timer(DebugTimer); TimeRegion Timer(DebugTimer);
DebugInfoFinder DbgFinder; DebugInfoFinder DbgFinder;
DbgFinder.processModule(*M); DbgFinder.processModule(*M);
bool HasDebugInfo = false;
// Scan all the compile-units to see if there are any marked as the main unit.
// if not, we do not generate debug info.
for (DebugInfoFinder::iterator I = DbgFinder.compile_unit_begin(),
E = DbgFinder.compile_unit_end(); I != E; ++I) {
if (DICompileUnit(*I).isMain()) {
HasDebugInfo = true;
break;
}
}
if (!HasDebugInfo) return;
// Tell MMI that we have debug info.
MMI->setDebugInfoAvailability(true);
// Emit initial sections. // Emit initial sections.
if (DbgFinder.compile_unit_begin() != DbgFinder.compile_unit_end()) EmitSectionLabels();
EmitSectionLabels();
// Create all the compile unit DIEs. // Create all the compile unit DIEs.
for (DebugInfoFinder::iterator I = DbgFinder.compile_unit_begin(), for (DebugInfoFinder::iterator I = DbgFinder.compile_unit_begin(),
E = DbgFinder.compile_unit_end(); I != E; ++I) E = DbgFinder.compile_unit_end(); I != E; ++I)
constructCompileUnit(*I); constructCompileUnit(*I);
if (!ModuleCU)
return;
// Create DIEs for each subprogram. // Create DIEs for each subprogram.
for (DebugInfoFinder::iterator I = DbgFinder.subprogram_begin(), for (DebugInfoFinder::iterator I = DbgFinder.subprogram_begin(),
E = DbgFinder.subprogram_end(); I != E; ++I) E = DbgFinder.subprogram_end(); I != E; ++I)
@@ -1821,10 +1836,6 @@ void DwarfDebug::beginModule(Module *M) {
E = DbgFinder.global_variable_end(); I != E; ++I) E = DbgFinder.global_variable_end(); I != E; ++I)
constructGlobalVariableDIE(*I); constructGlobalVariableDIE(*I);
MMI = Asm->MMI;
shouldEmit = true;
MMI->setDebugInfoAvailability(true);
// Prime section data. // Prime section data.
SectionMap.insert(Asm->getObjFileLowering().getTextSection()); SectionMap.insert(Asm->getObjFileLowering().getTextSection());

View File

@@ -60,8 +60,10 @@ public:
class DwarfDebug { class DwarfDebug {
/// Asm - Target of Dwarf emission. /// Asm - Target of Dwarf emission.
AsmPrinter *Asm; AsmPrinter *Asm;
public:
/// MMI - Collected machine module information. /// MMI - Collected machine module information.
MachineModuleInfo *MMI; MachineModuleInfo *MMI;
private:
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
// Attributes used to construct specific Dwarf sections. // Attributes used to construct specific Dwarf sections.

View File

@@ -72,7 +72,7 @@ void DwarfWriter::EndFunction(const MachineFunction *MF) {
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
/// be emitted. /// be emitted.
bool DwarfWriter::ShouldEmitDwarfDebug() const { bool DwarfWriter::ShouldEmitDwarfDebug() const {
return DD && DD->ShouldEmitDwarfDebug(); return DD && DD->MMI->hasDebugInfo();
} }
void DwarfWriter::BeginScope(const MachineInstr *MI) { void DwarfWriter::BeginScope(const MachineInstr *MI) {

View File

@@ -47,7 +47,6 @@
#include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/Analysis/DebugInfo.h" #include "llvm/Analysis/DebugInfo.h"
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetInstrInfo.h"
@@ -326,8 +325,8 @@ bool FastISel::SelectCall(User *I) {
default: break; default: break;
case Intrinsic::dbg_declare: { case Intrinsic::dbg_declare: {
DbgDeclareInst *DI = cast<DbgDeclareInst>(I); DbgDeclareInst *DI = cast<DbgDeclareInst>(I);
if (!DIDescriptor::ValidDebugInfo(DI->getVariable(), CodeGenOpt::None)||!DW if (!DIDescriptor::ValidDebugInfo(DI->getVariable(), CodeGenOpt::None) ||
|| !DW->ShouldEmitDwarfDebug()) !MMI->hasDebugInfo())
return true; return true;
Value *Address = DI->getAddress(); Value *Address = DI->getAddress();
@@ -735,7 +734,6 @@ FastISel::SelectOperator(User *I, unsigned Opcode) {
FastISel::FastISel(MachineFunction &mf, FastISel::FastISel(MachineFunction &mf,
MachineModuleInfo *mmi, MachineModuleInfo *mmi,
DwarfWriter *dw,
DenseMap<const Value *, unsigned> &vm, DenseMap<const Value *, unsigned> &vm,
DenseMap<const BasicBlock *, MachineBasicBlock *> &bm, DenseMap<const BasicBlock *, MachineBasicBlock *> &bm,
DenseMap<const AllocaInst *, int> &am DenseMap<const AllocaInst *, int> &am
@@ -752,7 +750,6 @@ FastISel::FastISel(MachineFunction &mf,
#endif #endif
MF(mf), MF(mf),
MMI(mmi), MMI(mmi),
DW(dw),
MRI(MF.getRegInfo()), MRI(MF.getRegInfo()),
MFI(*MF.getFrameInfo()), MFI(*MF.getFrameInfo()),
MCP(*MF.getConstantPool()), MCP(*MF.getConstantPool()),

View File

@@ -342,7 +342,7 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
// Mark landing pad. // Mark landing pad.
FuncInfo->MBBMap[Invoke->getSuccessor(1)]->setIsLandingPad(); FuncInfo->MBBMap[Invoke->getSuccessor(1)]->setIsLandingPad();
SelectAllBasicBlocks(Fn, *MF, MMI, DW, TII); SelectAllBasicBlocks(Fn, *MF, MMI, TII);
// If the first basic block in the function has live ins that need to be // If the first basic block in the function has live ins that need to be
// copied into vregs, emit the copies into the top of the block before // copied into vregs, emit the copies into the top of the block before
@@ -845,12 +845,11 @@ void SelectionDAGISel::DoInstructionSelection() {
void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn, void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
MachineFunction &MF, MachineFunction &MF,
MachineModuleInfo *MMI, MachineModuleInfo *MMI,
DwarfWriter *DW,
const TargetInstrInfo &TII) { const TargetInstrInfo &TII) {
// Initialize the Fast-ISel state, if needed. // Initialize the Fast-ISel state, if needed.
FastISel *FastIS = 0; FastISel *FastIS = 0;
if (EnableFastISel) if (EnableFastISel)
FastIS = TLI.createFastISel(MF, MMI, DW, FastIS = TLI.createFastISel(MF, MMI,
FuncInfo->ValueMap, FuncInfo->ValueMap,
FuncInfo->MBBMap, FuncInfo->MBBMap,
FuncInfo->StaticAllocaMap FuncInfo->StaticAllocaMap

View File

@@ -55,7 +55,6 @@ class X86FastISel : public FastISel {
public: public:
explicit X86FastISel(MachineFunction &mf, explicit X86FastISel(MachineFunction &mf,
MachineModuleInfo *mmi, MachineModuleInfo *mmi,
DwarfWriter *dw,
DenseMap<const Value *, unsigned> &vm, DenseMap<const Value *, unsigned> &vm,
DenseMap<const BasicBlock *, MachineBasicBlock *> &bm, DenseMap<const BasicBlock *, MachineBasicBlock *> &bm,
DenseMap<const AllocaInst *, int> &am DenseMap<const AllocaInst *, int> &am
@@ -63,7 +62,7 @@ public:
, SmallSet<Instruction*, 8> &cil , SmallSet<Instruction*, 8> &cil
#endif #endif
) )
: FastISel(mf, mmi, dw, vm, bm, am : FastISel(mf, mmi, vm, bm, am
#ifndef NDEBUG #ifndef NDEBUG
, cil , cil
#endif #endif
@@ -1754,7 +1753,6 @@ unsigned X86FastISel::TargetMaterializeAlloca(AllocaInst *C) {
namespace llvm { namespace llvm {
llvm::FastISel *X86::createFastISel(MachineFunction &mf, llvm::FastISel *X86::createFastISel(MachineFunction &mf,
MachineModuleInfo *mmi, MachineModuleInfo *mmi,
DwarfWriter *dw,
DenseMap<const Value *, unsigned> &vm, DenseMap<const Value *, unsigned> &vm,
DenseMap<const BasicBlock *, MachineBasicBlock *> &bm, DenseMap<const BasicBlock *, MachineBasicBlock *> &bm,
DenseMap<const AllocaInst *, int> &am DenseMap<const AllocaInst *, int> &am
@@ -1762,7 +1760,7 @@ namespace llvm {
, SmallSet<Instruction*, 8> &cil , SmallSet<Instruction*, 8> &cil
#endif #endif
) { ) {
return new X86FastISel(mf, mmi, dw, vm, bm, am return new X86FastISel(mf, mmi, vm, bm, am
#ifndef NDEBUG #ifndef NDEBUG
, cil , cil
#endif #endif

View File

@@ -2399,7 +2399,6 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
FastISel * FastISel *
X86TargetLowering::createFastISel(MachineFunction &mf, MachineModuleInfo *mmo, X86TargetLowering::createFastISel(MachineFunction &mf, MachineModuleInfo *mmo,
DwarfWriter *dw,
DenseMap<const Value *, unsigned> &vm, DenseMap<const Value *, unsigned> &vm,
DenseMap<const BasicBlock*, MachineBasicBlock*> &bm, DenseMap<const BasicBlock*, MachineBasicBlock*> &bm,
DenseMap<const AllocaInst *, int> &am DenseMap<const AllocaInst *, int> &am
@@ -2407,7 +2406,7 @@ X86TargetLowering::createFastISel(MachineFunction &mf, MachineModuleInfo *mmo,
, SmallSet<Instruction*, 8> &cil , SmallSet<Instruction*, 8> &cil
#endif #endif
) { ) {
return X86::createFastISel(mf, mmo, dw, vm, bm, am return X86::createFastISel(mf, mmo, vm, bm, am
#ifndef NDEBUG #ifndef NDEBUG
, cil , cil
#endif #endif

View File

@@ -574,8 +574,7 @@ namespace llvm {
/// createFastISel - This method returns a target specific FastISel object, /// createFastISel - This method returns a target specific FastISel object,
/// or null if the target does not support "fast" ISel. /// or null if the target does not support "fast" ISel.
virtual FastISel * virtual FastISel *
createFastISel(MachineFunction &mf, createFastISel(MachineFunction &mf, MachineModuleInfo *mmi,
MachineModuleInfo *mmi, DwarfWriter *dw,
DenseMap<const Value *, unsigned> &, DenseMap<const Value *, unsigned> &,
DenseMap<const BasicBlock *, MachineBasicBlock *> &, DenseMap<const BasicBlock *, MachineBasicBlock *> &,
DenseMap<const AllocaInst *, int> & DenseMap<const AllocaInst *, int> &
@@ -816,7 +815,7 @@ namespace llvm {
namespace X86 { namespace X86 {
FastISel *createFastISel(MachineFunction &mf, FastISel *createFastISel(MachineFunction &mf,
MachineModuleInfo *mmi, DwarfWriter *dw, MachineModuleInfo *mmi,
DenseMap<const Value *, unsigned> &, DenseMap<const Value *, unsigned> &,
DenseMap<const BasicBlock *, MachineBasicBlock *> &, DenseMap<const BasicBlock *, MachineBasicBlock *> &,
DenseMap<const AllocaInst *, int> & DenseMap<const AllocaInst *, int> &