llvm.org GIT mirror llvm / 3f3bf93
Reduce clutter in asm output. Do not emit source location as comment for each instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129715 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 9 years ago
8 changed file(s) with 22 addition(s) and 39 deletion(s). Raw diff Collapse all Expand all
421421 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
422422 unsigned Column, unsigned Flags,
423423 unsigned Isa,
424 unsigned Discriminator);
424 unsigned Discriminator,
425 StringRef FileName);
425426
426427 virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
427428 const MCSymbol *LastLabel,
485485 }
486486
487487
488 static void EmitDebugLoc(DebugLoc DL, const MachineFunction *MF,
489 raw_ostream &CommentOS) {
490 const LLVMContext &Ctx = MF->getFunction()->getContext();
491 if (!DL.isUnknown()) { // Print source line info.
492 DIScope Scope(DL.getScope(Ctx));
493 // Omit the directory, because it's likely to be long and uninteresting.
494 if (Scope.Verify())
495 CommentOS << Scope.getFilename();
496 else
497 CommentOS << "";
498 CommentOS << ':' << DL.getLine();
499 if (DL.getCol() != 0)
500 CommentOS << ':' << DL.getCol();
501 DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(DL.getInlinedAt(Ctx));
502 if (!InlinedAtDL.isUnknown()) {
503 CommentOS << "[ ";
504 EmitDebugLoc(InlinedAtDL, MF, CommentOS);
505 CommentOS << " ]";
506 }
507 }
508 }
509
510488 /// EmitComments - Pretty-print comments for instructions.
511489 static void EmitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
512490 const MachineFunction *MF = MI.getParent()->getParent();
513491 const TargetMachine &TM = MF->getTarget();
514
515 DebugLoc DL = MI.getDebugLoc();
516 if (!DL.isUnknown()) { // Print source line info.
517 EmitDebugLoc(DL, MF, CommentOS);
518 CommentOS << '\n';
519 }
520492
521493 // Check for spills and reloads
522494 int FI;
21452145
21462146 Src = GetOrCreateSourceID(Fn, Dir);
21472147 }
2148
21492148 Asm->OutStreamer.EmitDwarfLocDirective(Src, Line, Col, DWARF2_FLAG_IS_STMT,
2150 0, 0);
2149 0, 0, Fn);
21512150 }
21522151
21532152 //===----------------------------------------------------------------------===//
181181 virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Filename);
182182 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
183183 unsigned Column, unsigned Flags,
184 unsigned Isa, unsigned Discriminator);
184 unsigned Isa, unsigned Discriminator,
185 StringRef FileName);
185186
186187 virtual void EmitCFIStartProc();
187188 virtual void EmitCFIEndProc();
688689 void MCAsmStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
689690 unsigned Column, unsigned Flags,
690691 unsigned Isa,
691 unsigned Discriminator) {
692 unsigned Discriminator,
693 StringRef FileName) {
692694 this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,
693 Isa, Discriminator);
695 Isa, Discriminator, FileName);
694696 if (!UseLoc)
695697 return;
696698
716718 OS << "isa " << Isa;
717719 if (Discriminator)
718720 OS << "discriminator " << Discriminator;
721
722 if (IsVerboseAsm) {
723 OS.PadToColumn(MAI.getCommentColumn());
724 OS << MAI.getCommentString() << ' ' << FileName << ':'
725 << Line << ':' << Column;
726 }
719727 EmitEOL();
720728 }
721729
214214
215215 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
216216 unsigned Column, unsigned Flags,
217 unsigned Isa, unsigned Discriminator) {
217 unsigned Isa, unsigned Discriminator,
218 StringRef FileName) {
218219 LogCall("EmitDwarfLocDirective",
219220 "FileNo:" + Twine(FileNo) + " Line:" + Twine(Line) +
220221 " Column:" + Twine(Column) + " Flags:" + Twine(Flags) +
221222 " Isa:" + Twine(Isa) + " Discriminator:" + Twine(Discriminator));
222223 return Child->EmitDwarfLocDirective(FileNo, Line, Column, Flags,
223 Isa, Discriminator);
224 Isa, Discriminator, FileName);
224225 }
225226
226227 virtual void EmitInstruction(const MCInst &Inst) {
8888 }
8989 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
9090 unsigned Column, unsigned Flags,
91 unsigned Isa, unsigned Discriminator) {}
91 unsigned Isa, unsigned Discriminator,
92 StringRef FileName) {}
9293 virtual void EmitInstruction(const MCInst &Inst) {}
9394
9495 virtual void Finish() {}
22522252 }
22532253
22542254 getStreamer().EmitDwarfLocDirective(FileNumber, LineNumber, ColumnPos, Flags,
2255 Isa, Discriminator);
2255 Isa, Discriminator, StringRef());
22562256
22572257 return false;
22582258 }
134134 void MCStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
135135 unsigned Column, unsigned Flags,
136136 unsigned Isa,
137 unsigned Discriminator) {
137 unsigned Discriminator,
138 StringRef FileName) {
138139 getContext().setCurrentDwarfLoc(FileNo, Line, Column, Flags, Isa,
139140 Discriminator);
140141 }