[llvm] r199276 - Make sure we emit a relocation to the debug_ranges section in the

Eric Christopher echristo at gmail.com
Wed Jan 15 13:55:03 PST 2014


On Wed, Jan 15, 2014 at 11:37 AM, dblaikie at gmail.com <dblaikie at gmail.com> wrote:
>
>
> On Tue Jan 14 2014 at 4:10:57 PM, Eric Christopher <echristo at gmail.com>
> wrote:
>>
>> Author: echristo
>> Date: Tue Jan 14 18:04:29 2014
>> New Revision: 199276
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=199276&view=rev
>> Log:
>> Make sure we emit a relocation to the debug_ranges section in the
>> presence of CU ranges.
>>
>> Modified:
>>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
>>     llvm/trunk/test/DebugInfo/X86/cu-ranges.ll
>>
>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=199276&r1=199275&r2=199276&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Jan 14 18:04:29
>> 2014
>> @@ -209,6 +209,10 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
>>    else
>>      HasDwarfPubSections = DwarfPubSections == Enable;
>>
>> +  // For now only turn on CU ranges if we've explicitly asked for it
>> +  // or we have -ffunction-sections enabled.
>
>
> So where are we at the moment? No high_pc/low_pc on the CU at all, ever?
> Then AT_ranges if enabled or function sections?
>

No, low_pc if we haven't turned on AT_ranges.

> In theory we could save a few bytes per CU by using high_pc and low_pc if
> DwarfCURanges was requested, but function sections weren't in use? Or do we
> have a consumer that can't tolerate high_pc/low_pc?
>

We could...

>>
>> +  HasCURanges = DwarfCURanges || TargetMachine::getFunctionSections();
>
>
> Can we init this in the initializer list? (bonus points for then making the
> member const - but we don't do that consistently at the moment, so eh)
>

Yep. See above where there are 8 billion other things initialized like that :)

> & what's with "TargetMachine::getFunctionSections" - is that a constant? Oh,
> I see it's a command line argument (I still don't really understand which
> things use cl::opt, which things use API-level parameter passing, and what
> the intended ideal state is there...)
>

Yeah, it's an argument to the construction of the target machine too.
I don't know that this is ideal, but...

>>
>> +  /// \brief Returns whether or not to use AT_ranges for compilation
>> units.
>> +  bool useCURanges() { return HasCURanges; }
>
>
> Bit arbitrarily confusing between "Has" and "use" - and is there any merit
> in having an accessor that's only used from within the class anyway? (rather
> than just directly accessing the member variable)
>

Not particularly. I was keeping it that way so I could set it once and
then check it whenever. The accessor is just keeping with the style of
the rest. Originally I was going to put the check in the function but
decided only checking it once is easier.

-eric



More information about the llvm-commits mailing list