[llvm-commits] [llvm] r56628 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h lib/CodeGen/AsmPrinter/DwarfWriter.cpp lib/Target/CellSPU/SPUAsmPrinter.cpp lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrint

Evan Cheng evan.cheng at apple.com
Thu Sep 25 23:38:03 PDT 2008


On Sep 25, 2008, at 6:15 PM, Bill Wendling wrote:

> On Thu, Sep 25, 2008 at 5:45 PM, Evan Cheng <evan.cheng at apple.com>  
> wrote:
>> On Sep 25, 2008, at 5:28 PM, Bill Wendling wrote:
>>> +  /// ConstructDefaultScope - Construct a default scope for the
>>> subprogram.
>>> +  ///
>>> +  void ConstructDefaultScope(MachineFunction *MF) {
>>> +    // Find the correct subprogram descriptor.
>>> +    std::vector<SubprogramDesc *> Subprograms;
>>> +    MMI->getAnchoredDescriptors<SubprogramDesc>(*M, Subprograms);
>>> +
>>> +    for (unsigned i = 0, N = Subprograms.size(); i < N; ++i) {
>>> +      SubprogramDesc *SPD = Subprograms[i];
>>> +
>>> +      if (SPD->getName() == MF->getFunction()->getName()) {
>>
>> There has got to be a better way?! This is slow.
>>
> Yeah, it's a mess. I suppose that I could create a map from the name
> to the subprogram descriptor in MMI. That's the only way the
> information is carried.
>
> What do you think?

I don't totally understand the data structure and the code doesn't  
make a lot of sense to me. But take a look at getAnchoredDescriptors():

     T Desc;
     std::vector<GlobalVariable *> Globals;
     getGlobalVariablesUsing(M, Desc.getAnchorString(), Globals);

     for (unsigned i = 0, N = Globals.size(); i < N; ++i) {
       GlobalVariable *GV = Globals[i];

       // FIXME - In the short term, changes are too drastic to  
continue.
       if (DebugInfoDesc::TagFromGlobal(GV) == Desc.getTag() &&
           DebugInfoDesc::VersionFromGlobal(GV) == LLVMDebugVersion) {
         AnchoredDescs.push_back(cast<T>(DR.Deserialize(GV)));
       }


It seems like you should be able to something like DR.Deserialize(MF- 
 >getFunction())? The worst case should be to have walk through the  
globals and find the one that matches MF->getFunction()?

Evan

>
> -bw
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list