[llvm-commits] [llvm] r118975 - in /llvm/trunk: include/llvm/MC/MCContext.h include/llvm/MC/MCDwarf.h lib/MC/MCContext.cpp lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/directive_loc.s
Rafael Espindola
rafael.espindola at gmail.com
Fri Nov 12 19:18:27 PST 2010
Author: rafael
Date: Fri Nov 12 21:18:27 2010
New Revision: 118975
URL: http://llvm.org/viewvc/llvm-project?rev=118975&view=rev
Log:
Parse and remember discriminators in .loc line. I try to output them with
another patch.
This lets us parse a bit more of the gcc 4.5 output.
Modified:
llvm/trunk/include/llvm/MC/MCContext.h
llvm/trunk/include/llvm/MC/MCDwarf.h
llvm/trunk/lib/MC/MCContext.cpp
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
llvm/trunk/test/MC/AsmParser/directive_loc.s
Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=118975&r1=118974&r2=118975&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Fri Nov 12 21:18:27 2010
@@ -186,12 +186,14 @@
/// is assembled an entry in the line number table with this information and
/// the address of the instruction will be created.
void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column,
- unsigned Flags, unsigned Isa) {
+ unsigned Flags, unsigned Isa,
+ unsigned Discriminator) {
CurrentDwarfLoc.setFileNum(FileNum);
CurrentDwarfLoc.setLine(Line);
CurrentDwarfLoc.setColumn(Column);
CurrentDwarfLoc.setFlags(Flags);
CurrentDwarfLoc.setIsa(Isa);
+ CurrentDwarfLoc.setDiscriminator(Discriminator);
DwarfLocSeen = true;
}
void ClearDwarfLocSeen() { DwarfLocSeen = false; }
Modified: llvm/trunk/include/llvm/MC/MCDwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf.h?rev=118975&r1=118974&r2=118975&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCDwarf.h (original)
+++ llvm/trunk/include/llvm/MC/MCDwarf.h Fri Nov 12 21:18:27 2010
@@ -83,6 +83,8 @@
unsigned Flags;
// Isa
unsigned Isa;
+ // Discriminator
+ unsigned Discriminator;
// Flag that indicates the initial value of the is_stmt_start flag.
#define DWARF2_LINE_DEFAULT_IS_STMT 1
@@ -96,8 +98,9 @@
friend class MCContext;
friend class MCLineEntry;
MCDwarfLoc(unsigned fileNum, unsigned line, unsigned column, unsigned flags,
- unsigned isa)
- : FileNum(fileNum), Line(line), Column(column), Flags(flags), Isa(isa) {}
+ unsigned isa, unsigned discriminator)
+ : FileNum(fileNum), Line(line), Column(column), Flags(flags), Isa(isa),
+ Discriminator(discriminator) {}
// Allow the default copy constructor and assignment operator to be used
// for an MCDwarfLoc object.
@@ -118,6 +121,9 @@
/// getIsa - Get the Isa of this MCDwarfLoc.
unsigned getIsa() { return Isa; }
+ /// getDiscriminator - Get the Discriminator of this MCDwarfLoc.
+ unsigned getDiscriminator() { return Discriminator; }
+
/// setFileNum - Set the FileNum of this MCDwarfLoc.
void setFileNum(unsigned fileNum) { FileNum = fileNum; }
@@ -132,6 +138,11 @@
/// setIsa - Set the Isa of this MCDwarfLoc.
void setIsa(unsigned isa) { Isa = isa; }
+
+ /// setDiscriminator - Set the Discriminator of this MCDwarfLoc.
+ void setDiscriminator(unsigned discriminator) {
+ Discriminator = discriminator;
+ }
};
/// MCLineEntry - Instances of this class represent the line information for
Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=118975&r1=118974&r2=118975&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Fri Nov 12 21:18:27 2010
@@ -25,7 +25,7 @@
MCContext::MCContext(const MCAsmInfo &mai) : MAI(mai), NextUniqueID(0),
- CurrentDwarfLoc(0,0,0,0,0) {
+ CurrentDwarfLoc(0,0,0,0,0,0) {
MachOUniquingMap = 0;
ELFUniquingMap = 0;
COFFUniquingMap = 0;
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=118975&r1=118974&r2=118975&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Fri Nov 12 21:18:27 2010
@@ -2019,6 +2019,7 @@
unsigned Flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0;
unsigned Isa = 0;
+ int64_t Discriminator = 0;
if (getLexer().isNot(AsmToken::EndOfStatement)) {
for (;;) {
if (getLexer().is(AsmToken::EndOfStatement))
@@ -2070,6 +2071,10 @@
return Error(Loc, "isa number not a constant value");
}
}
+ else if (Name == "discriminator") {
+ if (getParser().ParseAbsoluteExpression(Discriminator))
+ return true;
+ }
else {
return Error(Loc, "unknown sub-directive in '.loc' directive");
}
@@ -2079,7 +2084,8 @@
}
}
- getContext().setCurrentDwarfLoc(FileNumber, LineNumber, ColumnPos, Flags,Isa);
+ getContext().setCurrentDwarfLoc(FileNumber, LineNumber, ColumnPos, Flags,
+ Isa, Discriminator);
return false;
}
Modified: llvm/trunk/test/MC/AsmParser/directive_loc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_loc.s?rev=118975&r1=118974&r2=118975&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_loc.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_loc.s Fri Nov 12 21:18:27 2010
@@ -5,4 +5,4 @@
.loc 1
.loc 1 2
.loc 1 2 3
-
+ .loc 1 2 discriminator 1
More information about the llvm-commits
mailing list