Skip to content
Snippets Groups Projects
Commit 3a7beafb authored by Tom Stellard's avatar Tom Stellard
Browse files

R600/SI: Emit configuration value in the .AMDGPU.config ELF section

llvm-svn: 179545
parent 9991659f
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,10 @@ ...@@ -21,7 +21,10 @@
#include "AMDGPU.h" #include "AMDGPU.h"
#include "SIMachineFunctionInfo.h" #include "SIMachineFunctionInfo.h"
#include "SIRegisterInfo.h" #include "SIRegisterInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCStreamer.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetRegistry.h"
#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetLoweringObjectFile.h"
...@@ -50,10 +53,15 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) { ...@@ -50,10 +53,15 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (OutStreamer.hasRawTextSupport()) { if (OutStreamer.hasRawTextSupport()) {
OutStreamer.EmitRawText("@" + MF.getName() + ":"); OutStreamer.EmitRawText("@" + MF.getName() + ":");
} }
OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
if (STM.device()->getGeneration() > AMDGPUDeviceInfo::HD6XXX) { 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); EmitProgramInfo(MF);
} }
OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
EmitFunctionBody(); EmitFunctionBody();
return false; return false;
} }
......
; RUN: llc < %s -march=r600 -mcpu=SI -filetype=obj | llvm-readobj -s - | FileCheck %s ; RUN: llc < %s -march=r600 -mcpu=SI -filetype=obj | llvm-readobj -s - | FileCheck %s
; CHECK: Format: ELF32 ; CHECK: Format: ELF32
; CHECK: Name: .AMDGPU.config
define void @test(i32 %p) { define void @test(i32 %p) {
%i = add i32 %p, 2 %i = add i32 %p, 2
%r = bitcast i32 %i to float %r = bitcast i32 %i to float
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment