[PATCH] R600/SI: Add comments for number of used registers.

Matt Arsenault Matthew.Arsenault at amd.com
Tue Nov 19 12:14:21 PST 2013


On 11/18/2013 10:36 AM, Tom Stellard wrote:
> On Sun, Nov 17, 2013 at 07:35:33PM -0800, Matt Arsenault wrote:
>>    Use EmitRawText to avoid indentation
>>
>> http://llvm-reviews.chandlerc.com/D2206
>>
>> CHANGE SINCE LAST DIFF
>>    http://llvm-reviews.chandlerc.com/D2206?vs=5616&id=5617#toc
>>
>> Files:
>>    lib/Target/R600/AMDGPUAsmPrinter.cpp
>>    lib/Target/R600/AMDGPUAsmPrinter.h
>>
>> Index: lib/Target/R600/AMDGPUAsmPrinter.cpp
>> ===================================================================
>> --- lib/Target/R600/AMDGPUAsmPrinter.cpp
>> +++ lib/Target/R600/AMDGPUAsmPrinter.cpp
>> @@ -46,8 +46,7 @@
>>   }
>>   
>>   AMDGPUAsmPrinter::AMDGPUAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
>> -    : AsmPrinter(TM, Streamer)
>> -{
>> +    : AsmPrinter(TM, Streamer) {
>>     DisasmEnabled = TM.getSubtarget<AMDGPUSubtarget>().dumpCode() &&
>>                     ! Streamer.hasRawTextSupport();
>>   }
>> @@ -56,6 +55,7 @@
>>   /// the call to EmitFunctionHeader(), which the MCPureStreamer can't handle.
>>   bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
>>     SetupMachineFunction(MF);
>> +
>>     if (OutStreamer.hasRawTextSupport()) {
>>       OutStreamer.EmitRawText("@" + MF.getName() + ":");
>>     }
>> @@ -65,9 +65,12 @@
>>                                                 ELF::SHT_PROGBITS, 0,
>>                                                 SectionKind::getReadOnly());
>>     OutStreamer.SwitchSection(ConfigSection);
>> +
>>     const AMDGPUSubtarget &STM = TM.getSubtarget<AMDGPUSubtarget>();
>> +  SIProgramInfo KernelInfo;
>>     if (STM.getGeneration() > AMDGPUSubtarget::NORTHERN_ISLANDS) {
>> -    EmitProgramInfoSI(MF);
>> +    findNumUsedRegistersSI(MF, KernelInfo.NumSGPR, KernelInfo.NumVGPR);
>> +    EmitProgramInfoSI(MF, KernelInfo);
>>     } else {
>>       EmitProgramInfoR600(MF);
>>     }
>> @@ -79,6 +82,14 @@
>>     OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
>>     EmitFunctionBody();
>>   
>> +  if (isVerbose() && OutStreamer.hasRawTextSupport()) {
>> +    // TODO: How can we prevent these from being indented?
>> +    OutStreamer.EmitRawText(
>> +      Twine("; Kernel info:\n") +
>> +      "; Max SGPR: " + Twine(KernelInfo.NumSGPR) + "\n" +
>> +      "; Max VGPR: " + Twine(KernelInfo.NumVGPR) + "\n\n\n");
>> +  }
>> +
> Can you stick this in an ELF section so it can be accessed from Mesa?
> The section name should be .AMDGPU.csdata and we should try to use the
> same formatting as the proprietary driver:
>
> NumVgprs             = 3;
> NumSgprs             = 13;
>
> Getting the whitespace correct is not important.
>
> -Tom
>
>
Why does Mesa need this? I just added this for convenience when reading 
the ISA. Doesn't mesa use the binary form of these which is already emitted?




More information about the llvm-commits mailing list