[llvm] r179545 - R600/SI: Emit configuration value in the .AMDGPU.config ELF section

Tom Stellard thomas.stellard at amd.com
Mon Apr 15 10:51:30 PDT 2013


Author: tstellar
Date: Mon Apr 15 12:51:30 2013
New Revision: 179545

URL: http://llvm.org/viewvc/llvm-project?rev=179545&view=rev
Log:
R600/SI: Emit configuration value in the .AMDGPU.config ELF section

Modified:
    llvm/trunk/lib/Target/R600/AMDGPUAsmPrinter.cpp
    llvm/trunk/test/CodeGen/R600/elf.ll

Modified: llvm/trunk/lib/Target/R600/AMDGPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUAsmPrinter.cpp?rev=179545&r1=179544&r2=179545&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUAsmPrinter.cpp Mon Apr 15 12:51:30 2013
@@ -21,7 +21,10 @@
 #include "AMDGPU.h"
 #include "SIMachineFunctionInfo.h"
 #include "SIRegisterInfo.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCSectionELF.h"
 #include "llvm/MC/MCStreamer.h"
+#include "llvm/Support/ELF.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 
@@ -50,10 +53,15 @@ bool AMDGPUAsmPrinter::runOnMachineFunct
   if (OutStreamer.hasRawTextSupport()) {
     OutStreamer.EmitRawText("@" + MF.getName() + ":");
   }
-  OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
   if (STM.device()->getGeneration() > AMDGPUDeviceInfo::HD6XXX) {
+    const MCSectionELF *ConfigSection = getObjFileLowering().getContext()
+                                                .getELFSection(".AMDGPU.config",
+                                                ELF::SHT_NULL, 0,
+                                                SectionKind::getReadOnly());
+    OutStreamer.SwitchSection(ConfigSection);
     EmitProgramInfo(MF);
   }
+  OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
   EmitFunctionBody();
   return false;
 }

Modified: llvm/trunk/test/CodeGen/R600/elf.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/elf.ll?rev=179545&r1=179544&r2=179545&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/R600/elf.ll (original)
+++ llvm/trunk/test/CodeGen/R600/elf.ll Mon Apr 15 12:51:30 2013
@@ -1,6 +1,7 @@
 ; RUN: llc < %s -march=r600 -mcpu=SI -filetype=obj | llvm-readobj -s - | FileCheck %s
 
 ; CHECK: Format: ELF32
+; CHECK: Name: .AMDGPU.config
 define void @test(i32 %p) {
    %i = add i32 %p, 2
    %r = bitcast i32 %i to float





More information about the llvm-commits mailing list