[LLVMdev] PIC16TargetAsmInfo::getBSSSectionForGlobal

Chris Lattner clattner at apple.com
Mon Jul 20 16:28:20 PDT 2009


On Jul 20, 2009, at 4:18 PM, Alireza.Moshtaghi at microchip.com wrote:

> Substituting the uses of a global with an absolute address would make
> all accesses to that global through pointer, which is very inefficient
> on PIC16. So we don't change the code generation for that global;
> instead we only pass the address information to the linker (home made
> linker) through some assembly directives.
> What are you trying to do? Are you trying to change the logic of this
> part or it is only simple refactoring?

My short term goal is to make TargetAsmInfo not depend on libvmcore.   
This means that no methods in it should take GlobalValue*'s for  
example.  There is a suite of GV classification methods that need to  
be moved somewhere else, probably in TargetLowering or asmprinter. One  
method in particular (SectionForGlobal) is virtual and only re- 
implemented for PIC16, which makes it an obvious candidate for changing.

I don't really understand all the section handling logic, but I have  
to untangle it.  It doesn't seem like it is properly factored somehow,  
so I'd like to simplify it while I'm moving stuff.  I don't want to  
break PIC16, but again, there are no testcases!

-Chris

>
> Regards
> Ali
>
>> -----Original Message-----
>> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev- 
>> bounces at cs.uiuc.edu]
> On
>> Behalf Of Chris Lattner
>> Sent: Monday, July 20, 2009 3:21 PM
>> To: Sanjiv Kumar Gupta - I00171
>> Cc: LLVM Developers Mailing List
>> Subject: [LLVMdev] PIC16TargetAsmInfo::getBSSSectionForGlobal
>>
>>
>> Hi Sanjiv,
>>
>> The PIC16TargetAsmInfo::getBSSSectionForGlobal apparently does magic
>> that reinterprets the "section" field of a global in a strange way:
>>
>>   // If GV has a sectin name or section address create that section
>> now.
>>   if (GV->hasSection()) {
>>     std::string SectName = GV->getSection();
>>     // If address for a variable is specified, get the address and
>> create
>>     // section.
>>     std::string AddrStr = "Address=";
>>     if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) {
>>       std::string SectAddr = SectName.substr(AddrStr.length());
>>       S = CreateSectionForGlobal(GV, SectAddr);
>>     }
>>
>> Why isn't the front-end handling this, replacing all uses of the
>> global with the address?  Does PIC allow initializing random sections
>> of globals like this?  I need to heavily refactor all this code, and
>> since there are no testcases at all for PIC16, I'm afraid of breaking
>> something.
>>
>> -Chris
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list