mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Reduce clutter in asm output. Do not emit source location as comment for each instruction.
llvm-svn: 129715
This commit is contained in:
parent
c2f25578a4
commit
7220c1a021
@ -422,7 +422,8 @@ namespace llvm {
|
||||
virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
|
||||
unsigned Column, unsigned Flags,
|
||||
unsigned Isa,
|
||||
unsigned Discriminator);
|
||||
unsigned Discriminator,
|
||||
StringRef FileName);
|
||||
|
||||
virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
|
||||
const MCSymbol *LastLabel,
|
||||
|
@ -486,39 +486,11 @@ void AsmPrinter::EmitFunctionEntryLabel() {
|
||||
}
|
||||
|
||||
|
||||
static void EmitDebugLoc(DebugLoc DL, const MachineFunction *MF,
|
||||
raw_ostream &CommentOS) {
|
||||
const LLVMContext &Ctx = MF->getFunction()->getContext();
|
||||
if (!DL.isUnknown()) { // Print source line info.
|
||||
DIScope Scope(DL.getScope(Ctx));
|
||||
// Omit the directory, because it's likely to be long and uninteresting.
|
||||
if (Scope.Verify())
|
||||
CommentOS << Scope.getFilename();
|
||||
else
|
||||
CommentOS << "<unknown>";
|
||||
CommentOS << ':' << DL.getLine();
|
||||
if (DL.getCol() != 0)
|
||||
CommentOS << ':' << DL.getCol();
|
||||
DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(DL.getInlinedAt(Ctx));
|
||||
if (!InlinedAtDL.isUnknown()) {
|
||||
CommentOS << "[ ";
|
||||
EmitDebugLoc(InlinedAtDL, MF, CommentOS);
|
||||
CommentOS << " ]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// EmitComments - Pretty-print comments for instructions.
|
||||
static void EmitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
|
||||
const MachineFunction *MF = MI.getParent()->getParent();
|
||||
const TargetMachine &TM = MF->getTarget();
|
||||
|
||||
DebugLoc DL = MI.getDebugLoc();
|
||||
if (!DL.isUnknown()) { // Print source line info.
|
||||
EmitDebugLoc(DL, MF, CommentOS);
|
||||
CommentOS << '\n';
|
||||
}
|
||||
|
||||
// Check for spills and reloads
|
||||
int FI;
|
||||
|
||||
|
@ -2146,9 +2146,8 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S){
|
||||
|
||||
Src = GetOrCreateSourceID(Fn, Dir);
|
||||
}
|
||||
|
||||
Asm->OutStreamer.EmitDwarfLocDirective(Src, Line, Col, DWARF2_FLAG_IS_STMT,
|
||||
0, 0);
|
||||
0, 0, Fn);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -182,7 +182,8 @@ public:
|
||||
virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Filename);
|
||||
virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
|
||||
unsigned Column, unsigned Flags,
|
||||
unsigned Isa, unsigned Discriminator);
|
||||
unsigned Isa, unsigned Discriminator,
|
||||
StringRef FileName);
|
||||
|
||||
virtual void EmitCFIStartProc();
|
||||
virtual void EmitCFIEndProc();
|
||||
@ -689,9 +690,10 @@ bool MCAsmStreamer::EmitDwarfFileDirective(unsigned FileNo, StringRef Filename){
|
||||
void MCAsmStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
|
||||
unsigned Column, unsigned Flags,
|
||||
unsigned Isa,
|
||||
unsigned Discriminator) {
|
||||
unsigned Discriminator,
|
||||
StringRef FileName) {
|
||||
this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,
|
||||
Isa, Discriminator);
|
||||
Isa, Discriminator, FileName);
|
||||
if (!UseLoc)
|
||||
return;
|
||||
|
||||
@ -717,6 +719,12 @@ void MCAsmStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
|
||||
OS << "isa " << Isa;
|
||||
if (Discriminator)
|
||||
OS << "discriminator " << Discriminator;
|
||||
|
||||
if (IsVerboseAsm) {
|
||||
OS.PadToColumn(MAI.getCommentColumn());
|
||||
OS << MAI.getCommentString() << ' ' << FileName << ':'
|
||||
<< Line << ':' << Column;
|
||||
}
|
||||
EmitEOL();
|
||||
}
|
||||
|
||||
|
@ -215,13 +215,14 @@ public:
|
||||
|
||||
virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
|
||||
unsigned Column, unsigned Flags,
|
||||
unsigned Isa, unsigned Discriminator) {
|
||||
unsigned Isa, unsigned Discriminator,
|
||||
StringRef FileName) {
|
||||
LogCall("EmitDwarfLocDirective",
|
||||
"FileNo:" + Twine(FileNo) + " Line:" + Twine(Line) +
|
||||
" Column:" + Twine(Column) + " Flags:" + Twine(Flags) +
|
||||
" Isa:" + Twine(Isa) + " Discriminator:" + Twine(Discriminator));
|
||||
return Child->EmitDwarfLocDirective(FileNo, Line, Column, Flags,
|
||||
Isa, Discriminator);
|
||||
Isa, Discriminator, FileName);
|
||||
}
|
||||
|
||||
virtual void EmitInstruction(const MCInst &Inst) {
|
||||
|
@ -89,7 +89,8 @@ namespace {
|
||||
}
|
||||
virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
|
||||
unsigned Column, unsigned Flags,
|
||||
unsigned Isa, unsigned Discriminator) {}
|
||||
unsigned Isa, unsigned Discriminator,
|
||||
StringRef FileName) {}
|
||||
virtual void EmitInstruction(const MCInst &Inst) {}
|
||||
|
||||
virtual void Finish() {}
|
||||
|
@ -2253,7 +2253,7 @@ bool GenericAsmParser::ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc) {
|
||||
}
|
||||
|
||||
getStreamer().EmitDwarfLocDirective(FileNumber, LineNumber, ColumnPos, Flags,
|
||||
Isa, Discriminator);
|
||||
Isa, Discriminator, StringRef());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -135,7 +135,8 @@ bool MCStreamer::EmitDwarfFileDirective(unsigned FileNo,
|
||||
void MCStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
|
||||
unsigned Column, unsigned Flags,
|
||||
unsigned Isa,
|
||||
unsigned Discriminator) {
|
||||
unsigned Discriminator,
|
||||
StringRef FileName) {
|
||||
getContext().setCurrentDwarfLoc(FileNo, Line, Column, Flags, Isa,
|
||||
Discriminator);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user