llvm.org GIT mirror llvm / 44c3b9f
Change the MachineDebugInfo to MachineModuleInfo to better reflect usage for debugging and exception handling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33550 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Laskey 13 years ago
21 changed file(s) with 121 addition(s) and 121 deletion(s). Raw diff Collapse all Expand all
280280 numbers. We recommend using with tags in the range 0x1000 thru 0x2000 (there is
281281 a defined enum DW_TAG_user_base = 0x1000.)

282282
283

The fields of debug descriptors used internally by LLVM (MachineDebugInfo)

283

The fields of debug descriptors used internally by LLVM (MachineModuleInfo)

284284 are restricted to only the simple data types int, uint,
285285 bool, float, double, sbyte* and { }*
286286 . References to arbitrary values are handled using a { }* and a
1111 // V.3 reference manual http://dwarf.freestandards.org ,
1212 //
1313 // The role of the Dwarf Writer class is to extract debug information from the
14 // MachineDebugInfo object, organize it in Dwarf form and then emit it into asm
14 // MachineModuleInfo object, organize it in Dwarf form and then emit it into asm
1515 // the current asm file using data and high level Dwarf directives.
1616 //
1717 //===----------------------------------------------------------------------===//
2525
2626 class AsmPrinter;
2727 class Dwarf;
28 class MachineDebugInfo;
28 class MachineModuleInfo;
2929 class MachineFunction;
3030 class Module;
3131 class TargetAsmInfo;
4545 DwarfWriter(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T);
4646 virtual ~DwarfWriter();
4747
48 /// SetDebugInfo - Set DebugInfo when it's known that pass manager has
49 /// created it. Set by the target AsmPrinter.
50 void SetDebugInfo(MachineDebugInfo *DI);
48 /// SetModuleInfo - Set machine module info when it's known that pass manager
49 /// has created it. Set by the target AsmPrinter.
50 void SetModuleInfo(MachineModuleInfo *MMI);
5151
5252 //===--------------------------------------------------------------------===//
5353 // Main entry points.
1616 class TargetData;
1717 class TargetRegisterClass;
1818 class Type;
19 class MachineDebugInfo;
19 class MachineModuleInfo;
2020 class MachineFunction;
2121
2222 /// The CalleeSavedInfo class tracks the information need to locate where a
146146 /// handling.
147147 std::vector CSInfo;
148148
149 /// DebugInfo - This field is set (via setMachineDebugInfo) by a debug info
149 /// MMI - This field is set (via setMachineModuleInfo) by a module info
150150 /// consumer (ex. DwarfWriter) to indicate that frame layout information
151151 /// should be acquired. Typically, it's the responsibility of the target's
152 /// MRegisterInfo prologue/epilogue emitting code to inform MachineDebugInfo
152 /// MRegisterInfo prologue/epilogue emitting code to inform MachineModuleInfo
153153 /// of frame layouts.
154 MachineDebugInfo *DebugInfo;
154 MachineModuleInfo *MMI;
155155
156156 public:
157157 MachineFrameInfo() {
159159 HasVarSizedObjects = false;
160160 HasCalls = false;
161161 MaxCallFrameSize = 0;
162 DebugInfo = 0;
162 MMI = 0;
163163 }
164164
165165 /// hasStackObjects - Return true if there are any stack objects in this
298298 CSInfo = CSI;
299299 }
300300
301 /// getMachineDebugInfo - Used by a prologue/epilogue emitter (MRegisterInfo)
301 /// getMachineModuleInfo - Used by a prologue/epilogue emitter (MRegisterInfo)
302302 /// to provide frame layout information.
303 MachineDebugInfo *getMachineDebugInfo() const { return DebugInfo; }
304
305 /// setMachineDebugInfo - Used by a debug consumer (DwarfWriter) to indicate
306 /// that frame layout information should be gathered.
307 void setMachineDebugInfo(MachineDebugInfo *DI) { DebugInfo = DI; }
303 MachineModuleInfo *getMachineModuleInfo() const { return MMI; }
304
305 /// setMachineModuleInfo - Used by a meta info consumer (DwarfWriter) to
306 /// indicate that frame layout information should be gathered.
307 void setMachineModuleInfo(MachineModuleInfo *mmi) { MMI = mmi; }
308308
309309 /// print - Used by the MachineFunction printer to print information about
310310 /// stack objects. Implemented in MachineFunction.cpp
1717 #ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
1818 #define LLVM_CODEGEN_MACHINEFUNCTION_H
1919
20 #include "llvm/CodeGen/MachineDebugInfo.h"
20 #include "llvm/CodeGen/MachineModuleInfo.h"
2121 #include "llvm/CodeGen/MachineBasicBlock.h"
2222 #include "llvm/Support/Annotation.h"
2323
2121 namespace llvm {
2222 struct InstrStage;
2323 class MachineConstantPool;
24 class MachineDebugInfo;
24 class MachineModuleInfo;
2525 class MachineInstr;
2626 class MRegisterInfo;
2727 class SelectionDAG;
2828 class AliasAnalysis;
2929 class TargetLowering;
3030 class TargetMachine;
31 class MachineDebugInfo;
31 class MachineModuleInfo;
3232 class MachineFunction;
3333 class MachineConstantPoolValue;
3434
4646 class SelectionDAG {
4747 TargetLowering &TLI;
4848 MachineFunction &MF;
49 MachineDebugInfo *DI;
49 MachineModuleInfo *MMI;
5050
5151 /// Root - The root of the entire DAG. EntryNode - The starting token.
5252 SDOperand Root, EntryNode;
5959 FoldingSet CSEMap;
6060
6161 public:
62 SelectionDAG(TargetLowering &tli, MachineFunction &mf, MachineDebugInfo *di)
63 : TLI(tli), MF(mf), DI(di) {
62 SelectionDAG(TargetLowering &tli, MachineFunction &mf, MachineModuleInfo *mmi)
63 : TLI(tli), MF(mf), MMI(mmi) {
6464 EntryNode = Root = getNode(ISD::EntryToken, MVT::Other);
6565 }
6666 ~SelectionDAG();
6868 MachineFunction &getMachineFunction() const { return MF; }
6969 const TargetMachine &getTarget() const;
7070 TargetLowering &getTargetLoweringInfo() const { return TLI; }
71 MachineDebugInfo *getMachineDebugInfo() const { return DI; }
71 MachineModuleInfo *getMachineModuleInfo() const { return MMI; }
7272
7373 /// viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
7474 ///
505505
506506 // DEBUG_LOC - This node is used to represent source line information
507507 // embedded in the code. It takes a token chain as input, then a line
508 // number, then a column then a file id (provided by MachineDebugInfo.) It
508 // number, then a column then a file id (provided by MachineModuleInfo.) It
509509 // produces a token chain as output.
510510 DEBUG_LOC,
511511
101101
102102 SwitchToDataSection(""); // Reset back to no section.
103103
104 if (MachineDebugInfo *DebugInfo = getAnalysisToUpdate()) {
105 DebugInfo->AnalyzeModule(M);
104 if (MachineModuleInfo *MMI = getAnalysisToUpdate()) {
105 MMI->AnalyzeModule(M);
106106 }
107107
108108 return false;
1717
1818 #define DEBUG_TYPE "branchfolding"
1919 #include "llvm/CodeGen/Passes.h"
20 #include "llvm/CodeGen/MachineDebugInfo.h"
20 #include "llvm/CodeGen/MachineModuleInfo.h"
2121 #include "llvm/CodeGen/MachineFunctionPass.h"
2222 #include "llvm/CodeGen/MachineJumpTableInfo.h"
2323 #include "llvm/Target/TargetInstrInfo.h"
3939 virtual bool runOnMachineFunction(MachineFunction &MF);
4040 virtual const char *getPassName() const { return "Control Flow Optimizer"; }
4141 const TargetInstrInfo *TII;
42 MachineDebugInfo *MDI;
42 MachineModuleInfo *MMI;
4343 bool MadeChange;
4444 private:
4545 // Tail Merging.
7474 MBB->removeSuccessor(MBB->succ_end()-1);
7575
7676 // If there is DWARF info to active, check to see if there are any LABEL
77 // records in the basic block. If so, unregister them from MachineDebugInfo.
78 if (MDI && !MBB->empty()) {
77 // records in the basic block. If so, unregister them from MachineModuleInfo.
78 if (MMI && !MBB->empty()) {
7979 for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end();
8080 I != E; ++I) {
8181 if ((unsigned)I->getOpcode() == TargetInstrInfo::LABEL) {
8282 // The label ID # is always operand #0, an immediate.
83 MDI->InvalidateLabel(I->getOperand(0).getImm());
83 MMI->InvalidateLabel(I->getOperand(0).getImm());
8484 }
8585 }
8686 }
9393 TII = MF.getTarget().getInstrInfo();
9494 if (!TII) return false;
9595
96 MDI = getAnalysisToUpdateInfo>();
96 MMI = getAnalysisToUpdateInfo>();
9797
9898 bool EverMadeChange = false;
9999 bool MadeChangeThisIteration = true;
1818 #include "llvm/Module.h"
1919 #include "llvm/Type.h"
2020 #include "llvm/CodeGen/AsmPrinter.h"
21 #include "llvm/CodeGen/MachineDebugInfo.h"
21 #include "llvm/CodeGen/MachineModuleInfo.h"
2222 #include "llvm/CodeGen/MachineFrameInfo.h"
2323 #include "llvm/CodeGen/MachineLocation.h"
2424 #include "llvm/Support/Dwarf.h"
785785 ///
786786 MachineFunction *MF;
787787
788 /// DebugInfo - Collected debug information.
789 ///
790 MachineDebugInfo *DebugInfo;
788 /// MMI - Collected machine module information.
789 ///
790 MachineModuleInfo *MMI;
791791
792792 /// didInitial - Flag to indicate if initial emission has been done.
793793 ///
806806 //
807807
808808 /// CompileUnits - All the compile units involved in this build. The index
809 /// of each entry in this vector corresponds to the sources in DebugInfo.
809 /// of each entry in this vector corresponds to the sources in MMI.
810810 std::vector CompileUnits;
811811
812812 /// AbbreviationsSet - Used to uniquely define abbreviations.
17011701 // FIXME - Ignore inlined functions for the time being.
17021702 if (!Scope->getParent()) continue;
17031703
1704 unsigned StartID = DebugInfo->MappedLabel(Scope->getStartLabelID());
1705 unsigned EndID = DebugInfo->MappedLabel(Scope->getEndLabelID());
1704 unsigned StartID = MMI->MappedLabel(Scope->getStartLabelID());
1705 unsigned EndID = MMI->MappedLabel(Scope->getEndLabelID());
17061706
17071707 // Ignore empty scopes.
17081708 if (StartID == EndID && StartID != 0) continue;
19321932 unsigned LabelID = Move.getLabelID();
19331933
19341934 if (LabelID) {
1935 LabelID = DebugInfo->MappedLabel(LabelID);
1935 LabelID = MMI->MappedLabel(LabelID);
19361936
19371937 // Throw out move if the label is invalid.
19381938 if (!LabelID) continue;
21192119 Asm->EmitInt8(0); Asm->EOL("DW_LNS_const_add_pc arg count");
21202120 Asm->EmitInt8(1); Asm->EOL("DW_LNS_fixed_advance_pc arg count");
21212121
2122 const UniqueVector &Directories = DebugInfo->getDirectories();
2122 const UniqueVector &Directories = MMI->getDirectories();
21232123 const UniqueVector
2124 &SourceFiles = DebugInfo->getSourceFiles();
2124 &SourceFiles = MMI->getSourceFiles();
21252125
21262126 // Emit directories.
21272127 for (unsigned DirectoryID = 1, NDID = Directories.size();
21612161 // Construct rows of the address, source, line, column matrix.
21622162 for (unsigned i = 0, N = LineInfos.size(); i < N; ++i) {
21632163 const SourceLineInfo &LineInfo = LineInfos[i];
2164 unsigned LabelID = DebugInfo->MappedLabel(LineInfo.getLabelID());
2164 unsigned LabelID = MMI->MappedLabel(LineInfo.getLabelID());
21652165 if (!LabelID) continue;
21662166
21672167 unsigned SourceID = LineInfo.getSourceID();
22942294 "func_begin", SubprogramCount);
22952295 Asm->EOL("FDE address range");
22962296
2297 std::vector &Moves = DebugInfo->getFrameMoves();
2297 std::vector &Moves = MMI->getFrameMoves();
22982298
22992299 EmitFrameMoves("func_begin", SubprogramCount, Moves);
23002300
24322432 /// ConstructCompileUnitDIEs - Create a compile unit DIE for each source and
24332433 /// header file.
24342434 void ConstructCompileUnitDIEs() {
2435 const UniqueVector CUW = DebugInfo->getCompileUnits();
2435 const UniqueVector CUW = MMI->getCompileUnits();
24362436
24372437 for (unsigned i = 1, N = CUW.size(); i <= N; ++i) {
2438 unsigned ID = DebugInfo->RecordSource(CUW[i]);
2438 unsigned ID = MMI->RecordSource(CUW[i]);
24392439 CompileUnit *Unit = NewCompileUnit(CUW[i], ID);
24402440 CompileUnits.push_back(Unit);
24412441 }
24452445 /// global variables.
24462446 void ConstructGlobalDIEs() {
24472447 std::vector GlobalVariables =
2448 DebugInfo->getAnchoredDescriptors(*M);
2448 MMI->getAnchoredDescriptors(*M);
24492449
24502450 for (unsigned i = 0, N = GlobalVariables.size(); i < N; ++i) {
24512451 GlobalVariableDesc *GVD = GlobalVariables[i];
24572457 /// subprograms.
24582458 void ConstructSubprogramDIEs() {
24592459 std::vector Subprograms =
2460 DebugInfo->getAnchoredDescriptors(*M);
2460 MMI->getAnchoredDescriptors(*M);
24612461
24622462 for (unsigned i = 0, N = Subprograms.size(); i < N; ++i) {
24632463 SubprogramDesc *SPD = Subprograms[i];
24812481 , RI(Asm->TM.getRegisterInfo())
24822482 , M(NULL)
24832483 , MF(NULL)
2484 , DebugInfo(NULL)
2484 , MMI(NULL)
24852485 , didInitial(false)
24862486 , shouldEmit(false)
24872487 , SubprogramCount(0)
25072507 //
25082508 const TargetAsmInfo *getTargetAsmInfo() const { return TAI; }
25092509
2510 /// SetDebugInfo - Set DebugInfo when it's known that pass manager has
2511 /// created it. Set by the target AsmPrinter.
2512 void SetDebugInfo(MachineDebugInfo *DI) {
2510 /// SetModuleInfo - Set machine module information when it's known that pass
2511 /// manager has created it. Set by the target AsmPrinter.
2512 void SetModuleInfo(MachineModuleInfo *mmi) {
25132513 // Make sure initial declarations are made.
2514 if (!DebugInfo && DI->hasInfo()) {
2515 DebugInfo = DI;
2514 if (!MMI && mmi->hasDebugInfo()) {
2515 MMI = mmi;
25162516 shouldEmit = true;
25172517
25182518 // Emit initial sections
25992599 Asm->EOL("Dwarf Begin Function");
26002600
26012601 // Begin accumulating function debug information.
2602 DebugInfo->BeginFunction(MF);
2602 MMI->BeginFunction(MF);
26032603
26042604 // Assumes in correct section after the entry point.
26052605 EmitLabel("func_begin", ++SubprogramCount);
26152615 EmitLabel("func_end", SubprogramCount);
26162616
26172617 // Get function line info.
2618 const std::vector &LineInfos = DebugInfo->getSourceLines();
2618 const std::vector &LineInfos = MMI->getSourceLines();
26192619
26202620 if (!LineInfos.empty()) {
26212621 // Get section line info.
26282628 }
26292629
26302630 // Construct scopes for subprogram.
2631 ConstructRootScope(DebugInfo->getRootScope());
2631 ConstructRootScope(MMI->getRootScope());
26322632
26332633 // Emit function frame information.
26342634 EmitFunctionDebugFrame();
26352635
26362636 // Reset the line numbers for the next function.
2637 DebugInfo->ClearLineInfo();
2637 MMI->ClearLineInfo();
26382638
26392639 // Clear function debug information.
2640 DebugInfo->EndFunction();
2640 MMI->EndFunction();
26412641 }
26422642 };
26432643
29472947 delete DW;
29482948 }
29492949
2950 /// SetDebugInfo - Set DebugInfo when it's known that pass manager has
2951 /// created it. Set by the target AsmPrinter.
2952 void DwarfWriter::SetDebugInfo(MachineDebugInfo *DI) {
2953 DW->SetDebugInfo(DI);
2950 /// SetModuleInfo - Set machine module info when it's known that pass manager
2951 /// has created it. Set by the target AsmPrinter.
2952 void DwarfWriter::SetModuleInfo(MachineModuleInfo *MMI) {
2953 DW->SetModuleInfo(MMI);
29542954 }
29552955
29562956 /// BeginModule - Emit all Dwarf sections that should come prior to the
3737 /// frame indexes with appropriate references.
3838 ///
3939 bool runOnMachineFunction(MachineFunction &Fn) {
40 // Get MachineDebugInfo so that we can track the construction of the
40 // Get MachineModuleInfo so that we can track the construction of the
4141 // frame.
42 if (MachineDebugInfo *DI = getAnalysisToUpdate()) {
43 Fn.getFrameInfo()->setMachineDebugInfo(DI);
42 if (MachineModuleInfo *MMI = getAnalysisToUpdate()) {
43 Fn.getFrameInfo()->setMachineModuleInfo(MMI);
4444 }
4545
4646 // Allow the target machine to make some adjustments to the function
734734 case TargetLowering::Promote:
735735 default: assert(0 && "This action is not supported yet!");
736736 case TargetLowering::Expand: {
737 MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo();
737 MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
738738 bool useDEBUG_LOC = TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other);
739739 bool useLABEL = TLI.isOperationLegal(ISD::LABEL, MVT::Other);
740740
741 if (DebugInfo && (useDEBUG_LOC || useLABEL)) {
741 if (MMI && (useDEBUG_LOC || useLABEL)) {
742742 const std::string &FName =
743743 cast(Node->getOperand(3))->getValue();
744744 const std::string &DirName =
745745 cast(Node->getOperand(4))->getValue();
746 unsigned SrcFile = DebugInfo->RecordSource(DirName, FName);
746 unsigned SrcFile = MMI->RecordSource(DirName, FName);
747747
748748 SmallVector Ops;
749749 Ops.push_back(Tmp1); // chain
758758 } else {
759759 unsigned Line = cast(LineOp)->getValue();
760760 unsigned Col = cast(ColOp)->getValue();
761 unsigned ID = DebugInfo->RecordLabel(Line, Col, SrcFile);
761 unsigned ID = MMI->RecordLabel(Line, Col, SrcFile);
762762 Ops.push_back(DAG.getConstant(ID, MVT::i32));
763763 Result = DAG.getNode(ISD::LABEL, MVT::Other,&Ops[0],Ops.size());
764764 }
2323 #include "llvm/Instructions.h"
2424 #include "llvm/Intrinsics.h"
2525 #include "llvm/IntrinsicInst.h"
26 #include "llvm/CodeGen/MachineDebugInfo.h"
26 #include "llvm/CodeGen/MachineModuleInfo.h"
2727 #include "llvm/CodeGen/MachineFunction.h"
2828 #include "llvm/CodeGen/MachineFrameInfo.h"
2929 #include "llvm/CodeGen/MachineJumpTableInfo.h"
19531953 return 0;
19541954
19551955 case Intrinsic::dbg_stoppoint: {
1956 MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo();
1956 MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
19571957 DbgStopPointInst &SPI = cast(I);
1958 if (DebugInfo && SPI.getContext() && DebugInfo->Verify(SPI.getContext())) {
1958 if (MMI && SPI.getContext() && MMI->Verify(SPI.getContext())) {
19591959 SDOperand Ops[5];
19601960
19611961 Ops[0] = getRoot();
19621962 Ops[1] = getValue(SPI.getLineValue());
19631963 Ops[2] = getValue(SPI.getColumnValue());
19641964
1965 DebugInfoDesc *DD = DebugInfo->getDescFor(SPI.getContext());
1965 DebugInfoDesc *DD = MMI->getDescFor(SPI.getContext());
19661966 assert(DD && "Not a debug information descriptor");
19671967 CompileUnitDesc *CompileUnit = cast(DD);
19681968
19751975 return 0;
19761976 }
19771977 case Intrinsic::dbg_region_start: {
1978 MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo();
1978 MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
19791979 DbgRegionStartInst &RSI = cast(I);
1980 if (DebugInfo && RSI.getContext() && DebugInfo->Verify(RSI.getContext())) {
1981 unsigned LabelID = DebugInfo->RecordRegionStart(RSI.getContext());
1980 if (MMI && RSI.getContext() && MMI->Verify(RSI.getContext())) {
1981 unsigned LabelID = MMI->RecordRegionStart(RSI.getContext());
19821982 DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(),
19831983 DAG.getConstant(LabelID, MVT::i32)));
19841984 }
19861986 return 0;
19871987 }
19881988 case Intrinsic::dbg_region_end: {
1989 MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo();
1989 MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
19901990 DbgRegionEndInst &REI = cast(I);
1991 if (DebugInfo && REI.getContext() && DebugInfo->Verify(REI.getContext())) {
1992 unsigned LabelID = DebugInfo->RecordRegionEnd(REI.getContext());
1991 if (MMI && REI.getContext() && MMI->Verify(REI.getContext())) {
1992 unsigned LabelID = MMI->RecordRegionEnd(REI.getContext());
19931993 DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other,
19941994 getRoot(), DAG.getConstant(LabelID, MVT::i32)));
19951995 }
19971997 return 0;
19981998 }
19991999 case Intrinsic::dbg_func_start: {
2000 MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo();
2000 MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
20012001 DbgFuncStartInst &FSI = cast(I);
2002 if (DebugInfo && FSI.getSubprogram() &&
2003 DebugInfo->Verify(FSI.getSubprogram())) {
2004 unsigned LabelID = DebugInfo->RecordRegionStart(FSI.getSubprogram());
2002 if (MMI && FSI.getSubprogram() &&
2003 MMI->Verify(FSI.getSubprogram())) {
2004 unsigned LabelID = MMI->RecordRegionStart(FSI.getSubprogram());
20052005 DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other,
20062006 getRoot(), DAG.getConstant(LabelID, MVT::i32)));
20072007 }
20092009 return 0;
20102010 }
20112011 case Intrinsic::dbg_declare: {
2012 MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo();
2012 MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
20132013 DbgDeclareInst &DI = cast(I);
2014 if (DebugInfo && DI.getVariable() && DebugInfo->Verify(DI.getVariable())) {
2014 if (MMI && DI.getVariable() && MMI->Verify(DI.getVariable())) {
20152015 SDOperand AddressOp = getValue(DI.getAddress());
20162016 if (FrameIndexSDNode *FI = dyn_cast(AddressOp))
2017 DebugInfo->RecordVariable(DI.getVariable(), FI->getIndex());
2017 MMI->RecordVariable(DI.getVariable(), FI->getIndex());
20182018 }
20192019
20202020 return 0;
41274127 FunctionLoweringInfo &FuncInfo) {
41284128 std::vector > PHINodesToUpdate;
41294129 {
4130 SelectionDAG DAG(TLI, MF, getAnalysisToUpdateDebugInfo>());
4130 SelectionDAG DAG(TLI, MF, getAnalysisToUpdateModuleInfo>());
41314131 CurDAG = &DAG;
41324132
41334133 // First step, lower LLVM code to some DAG. This DAG may use operations and
41564156 // whether the PHI is a successor of the range check MBB or the jump table MBB
41574157 if (JT.Reg) {
41584158 assert(SwitchCases.empty() && "Cannot have jump table and lowered switch");
4159 SelectionDAG SDAG(TLI, MF, getAnalysisToUpdateDebugInfo>());
4159 SelectionDAG SDAG(TLI, MF, getAnalysisToUpdateModuleInfo>());
41604160 CurDAG = &SDAG;
41614161 SelectionDAGLowering SDL(SDAG, TLI, FuncInfo);
41624162 MachineBasicBlock *RangeBB = BB;
42004200 // If we generated any switch lowering information, build and codegen any
42014201 // additional DAGs necessary.
42024202 for (unsigned i = 0, e = SwitchCases.size(); i != e; ++i) {
4203 SelectionDAG SDAG(TLI, MF, getAnalysisToUpdateDebugInfo>());
4203 SelectionDAG SDAG(TLI, MF, getAnalysisToUpdateModuleInfo>());
42044204 CurDAG = &SDAG;
42054205 SelectionDAGLowering SDL(SDAG, TLI, FuncInfo);
42064206
2222 #include "llvm/Module.h"
2323 #include "llvm/CodeGen/AsmPrinter.h"
2424 #include "llvm/CodeGen/DwarfWriter.h"
25 #include "llvm/CodeGen/MachineDebugInfo.h"
25 #include "llvm/CodeGen/MachineModuleInfo.h"
2626 #include "llvm/CodeGen/MachineFunctionPass.h"
2727 #include "llvm/CodeGen/MachineJumpTableInfo.h"
2828 #include "llvm/Target/TargetAsmInfo.h"
141141
142142 void getAnalysisUsage(AnalysisUsage &AU) const {
143143 AU.setPreservesAll();
144 AU.addRequiredDebugInfo>();
144 AU.addRequiredModuleInfo>();
145145 }
146146 };
147147 } // end of anonymous namespace
165165 AFI = MF.getInfo();
166166
167167 if (Subtarget->isTargetDarwin()) {
168 DW.SetDebugInfo(&getAnalysisInfo>());
168 DW.SetModuleInfo(&getAnalysisInfo>());
169169 }
170170
171171 SetupMachineFunction(MF);
2626 #include "llvm/Assembly/Writer.h"
2727 #include "llvm/CodeGen/AsmPrinter.h"
2828 #include "llvm/CodeGen/DwarfWriter.h"
29 #include "llvm/CodeGen/MachineDebugInfo.h"
29 #include "llvm/CodeGen/MachineModuleInfo.h"
3030 #include "llvm/CodeGen/MachineFunctionPass.h"
3131 #include "llvm/CodeGen/MachineInstr.h"
3232 #include "llvm/Support/Mangler.h"
301301
302302 void getAnalysisUsage(AnalysisUsage &AU) const {
303303 AU.setPreservesAll();
304 AU.addRequiredDebugInfo>();
304 AU.addRequiredModuleInfo>();
305305 PPCAsmPrinter::getAnalysisUsage(AU);
306306 }
307307
331331
332332 void getAnalysisUsage(AnalysisUsage &AU) const {
333333 AU.setPreservesAll();
334 AU.addRequiredDebugInfo>();
334 AU.addRequiredModuleInfo>();
335335 PPCAsmPrinter::getAnalysisUsage(AU);
336336 }
337337
527527 /// method to print assembly for each instruction.
528528 ///
529529 bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
530 DW.SetDebugInfo(&getAnalysisInfo>());
530 DW.SetModuleInfo(&getAnalysisInfo>());
531531
532532 SetupMachineFunction(MF);
533533 O << "\n\n";
737737 /// method to print assembly for each instruction.
738738 ///
739739 bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
740 DW.SetDebugInfo(&getAnalysisInfo>());
740 DW.SetModuleInfo(&getAnalysisInfo>());
741741
742742 SetupMachineFunction(MF);
743743 O << "\n\n";
2121 #include "llvm/Type.h"
2222 #include "llvm/CodeGen/ValueTypes.h"
2323 #include "llvm/CodeGen/MachineInstrBuilder.h"
24 #include "llvm/CodeGen/MachineDebugInfo.h"
24 #include "llvm/CodeGen/MachineModuleInfo.h"
2525 #include "llvm/CodeGen/MachineFunction.h"
2626 #include "llvm/CodeGen/MachineFrameInfo.h"
2727 #include "llvm/CodeGen/MachineLocation.h"
753753 MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB
754754 MachineBasicBlock::iterator MBBI = MBB.begin();
755755 MachineFrameInfo *MFI = MF.getFrameInfo();
756 MachineDebugInfo *DebugInfo = MFI->getMachineDebugInfo();
756 MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
757757
758758 // Prepare for debug frame info.
759 bool hasInfo = DebugInfo && DebugInfo->hasInfo();
759 bool hasDebugInfo = MMI && MMI->hasDebugInfo();
760760 unsigned FrameLabelId = 0;
761761
762762 // Scan the prolog, looking for an UPDATE_VRSAVE instruction. If we find it,
818818 unsigned TargetAlign = MF.getTarget().getFrameInfo()->getStackAlignment();
819819 unsigned MaxAlign = MFI->getMaxAlignment();
820820
821 if (hasInfo) {
821 if (hasDebugInfo) {
822822 // Mark effective beginning of when frame pointer becomes valid.
823 FrameLabelId = DebugInfo->NextLabelID();
823 FrameLabelId = MMI->NextLabelID();
824824 BuildMI(MBB, MBBI, TII.get(PPC::LABEL)).addImm(FrameLabelId);
825825 }
826826
869869 }
870870 }
871871
872 if (hasInfo) {
873 std::vector &Moves = DebugInfo->getFrameMoves();
872 if (hasDebugInfo) {
873 std::vector &Moves = MMI->getFrameMoves();
874874
875875 if (NegFrameSize) {
876876 // Show update of SP.
900900 }
901901
902902 // Mark effective beginning of when frame pointer is ready.
903 unsigned ReadyLabelId = DebugInfo->NextLabelID();
903 unsigned ReadyLabelId = MMI->NextLabelID();
904904 BuildMI(MBB, MBBI, TII.get(PPC::LABEL)).addImm(ReadyLabelId);
905905
906906 MachineLocation FPDst(HasFP ? (IsPPC64 ? PPC::X31 : PPC::R31) :
7474 Subtarget->isTargetELF() ||
7575 Subtarget->isTargetCygMing()) {
7676 // Let PassManager know we need debug information and relay
77 // the MachineDebugInfo address on to DwarfWriter.
78 DW.SetDebugInfo(&getAnalysis());
77 // the MachineModuleInfo address on to DwarfWriter.
78 DW.SetModuleInfo(&getAnalysis());
7979 }
8080
8181 SetupMachineFunction(MF);
2020 #include "X86TargetMachine.h"
2121 #include "llvm/CodeGen/AsmPrinter.h"
2222 #include "llvm/CodeGen/DwarfWriter.h"
23 #include "llvm/CodeGen/MachineDebugInfo.h"
23 #include "llvm/CodeGen/MachineModuleInfo.h"
2424 #include "llvm/Support/Compiler.h"
2525 #include
2626
6060 if (Subtarget->isTargetDarwin() ||
6161 Subtarget->isTargetELF() ||
6262 Subtarget->isTargetCygMing()) {
63 AU.addRequiredDebugInfo>();
63 AU.addRequiredModuleInfo>();
6464 }
6565 MachineFunctionPass::getAnalysisUsage(AU);
6666 }
994994 const Function* Fn = MF.getFunction();
995995 const X86Subtarget* Subtarget = &MF.getTarget().getSubtarget();
996996 MachineInstr *MI;
997 MachineDebugInfo *DebugInfo = MFI->getMachineDebugInfo();
997 MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
998998
999999 // Prepare for debug frame info.
1000 bool hasInfo = DebugInfo && DebugInfo->hasInfo();
1000 bool hasDebugInfo = MMI && MMI->hasDebugInfo();
10011001 unsigned FrameLabelId = 0;
10021002
10031003 // Get the number of bytes to allocate from the FrameInfo
10221022 }
10231023 }
10241024
1025 if (hasInfo) {
1025 if (hasDebugInfo) {
10261026 // Mark effective beginning of when frame pointer becomes valid.
1027 FrameLabelId = DebugInfo->NextLabelID();
1027 FrameLabelId = MMI->NextLabelID();
10281028 BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(FrameLabelId);
10291029 }
10301030
10521052 MBB.insert(MBBI, MI);
10531053 }
10541054
1055 if (hasInfo) {
1056 std::vector &Moves = DebugInfo->getFrameMoves();
1055 if (hasDebugInfo) {
1056 std::vector &Moves = MMI->getFrameMoves();
10571057
10581058 if (NumBytes) {
10591059 // Show update of SP.
10761076 }
10771077
10781078 // Mark effective beginning of when frame pointer is ready.
1079 unsigned ReadyLabelId = DebugInfo->NextLabelID();
1079 unsigned ReadyLabelId = MMI->NextLabelID();
10801080 BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(ReadyLabelId);
10811081
10821082 MachineLocation FPDst(hasFP(MF) ? FramePtr : StackPtr);
119119 // attribute((used)).
120120 ExternalNames.insert("llvm.used");
121121
122 // Never internalize anchors used by the debugger, else the debugger won't
123 // find them. (see MachineDebugInfo.)
122 // Never internalize anchors used by the machine module info, else the info
123 // won't find them. (see MachineModuleInfo.)
124124 ExternalNames.insert("llvm.dbg.compile_units");
125125 ExternalNames.insert("llvm.dbg.global_variables");
126126 ExternalNames.insert("llvm.dbg.subprograms");
2727 #include "llvm/IntrinsicInst.h"
2828 #include "llvm/Constants.h"
2929 #include "llvm/GlobalVariable.h"
30 #include "llvm/CodeGen/MachineDebugInfo.h"
30 #include "llvm/CodeGen/MachineModuleInfo.h"
3131 using namespace llvm;
3232
3333 //===----------------------------------------------------------------------===//