[llvm-commits] [llvm] r61928 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Devang Patel
dpatel at apple.com
Thu Jan 8 13:47:46 PST 2009
On Jan 8, 2009, at 1:36 PM, Evan Cheng wrote:
>> ------------------------------------------------------------------=
>> ==//
>> +/// SourceLineInfo - This class is used to record source line
>> correspondence.
>> +///
>> +class SrcLineInfo {
>> + unsigned Line; // Source line number.
>> + unsigned Column; // Source column.
>> + unsigned SourceID; // Source ID number.
>> + unsigned LabelID; // Label in code ID number.
>
> Do we have to use unsigned for each of these fields? Can we shrink the
> data structure (if that matters)?
I do not know. Right now, I am shamelessly coping this data structure
and their
apis from MMI.
>
>
>>
>> +public:
>> + SrcLineInfo(unsigned L, unsigned C, unsigned S, unsigned I)
>> + : Line(L), Column(C), SourceID(S), LabelID(I) {}
>> +
>> + // Accessors
>> + unsigned getLine() const { return Line; }
>> + unsigned getColumn() const { return Column; }
>> + unsigned getSourceID() const { return SourceID; }
>> + unsigned getLabelID() const { return LabelID; }
>> +};
>> +
>> +
>> +//
>> =
>> =
>> =
>> ----------------------------------------------------------------------=
>> ==//
>> /// SrcFileInfo - This class is used to track source information.
>> ///
>> class SrcFileInfo {
>> @@ -1259,7 +1279,7 @@
>> /// CompileUnits - All the compile units involved in this build.
>> The index
>> /// of each entry in this vector corresponds to the sources in MMI.
>> std::vector<CompileUnit *> CompileUnits;
>> - DenseMap<GlobalVariable *, CompileUnit *> DW_CUs;
>> + DenseMap<Value *, CompileUnit *> DW_CUs;
>>
>> /// AbbreviationsSet - Used to uniquely define abbreviations.
>> ///
>> @@ -1277,6 +1297,9 @@
>> // SourceFiles - Uniquing vector for source files.
>> UniqueVector<SrcFileInfo> SrcFiles;
>>
>> + // Lines - List of of source line correspondence.
>> + std::vector<SrcLineInfo> Lines;
>> +
>> FoldingSet<DIEValue> ValuesSet;
>>
>> /// Values - A list of all the unique values in use.
>> @@ -2539,6 +2562,23 @@
>> return VariableDie;
>> }
>>
>> + unsigned RecordSourceLine(Value *V, unsigned Line, unsigned Col) {
>> + CompileUnit *Unit = DW_CUs[V];
>> + assert (Unit && "Unable to find CompileUnit");
>> + unsigned ID = NextLabelID();
>> + Lines.push_back(SrcLineInfo(Line, Col, Unit->getID(), ID));
>> + return ID;
>> + }
>
> Comments plz. :-)
ok
>> +
>> + unsigned getRecordSourceLineCount() {
>> + return Lines.size();
>> + }
>
> Does this gets called a lot? If so, we want to keep the count
> separately.
It is called once per function start. Again, this matches MMI.
-
Devang
More information about the llvm-commits
mailing list