forked from OSchip/llvm-project
AMDGPU: Emit note directive for HSA even if there are no functions
Reviewers: arsenm, echristo Subscribers: arsenm, llvm-commits Differential Revision: http://reviews.llvm.org/D16010 llvm-svn: 257488
This commit is contained in:
parent
029d0b7328
commit
f421837250
|
@ -91,6 +91,25 @@ AMDGPUAsmPrinter::AMDGPUAsmPrinter(TargetMachine &TM,
|
||||||
std::unique_ptr<MCStreamer> Streamer)
|
std::unique_ptr<MCStreamer> Streamer)
|
||||||
: AsmPrinter(TM, std::move(Streamer)) {}
|
: AsmPrinter(TM, std::move(Streamer)) {}
|
||||||
|
|
||||||
|
void AMDGPUAsmPrinter::EmitStartOfAsmFile(Module &M) {
|
||||||
|
if (TM.getTargetTriple().getOS() != Triple::AMDHSA)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Need to construct an MCSubtargetInfo here in case we have no functions
|
||||||
|
// in the module.
|
||||||
|
std::unique_ptr<MCSubtargetInfo> STI(TM.getTarget().createMCSubtargetInfo(
|
||||||
|
TM.getTargetTriple().str(), TM.getTargetCPU(),
|
||||||
|
TM.getTargetFeatureString()));
|
||||||
|
|
||||||
|
AMDGPUTargetStreamer *TS =
|
||||||
|
static_cast<AMDGPUTargetStreamer *>(OutStreamer->getTargetStreamer());
|
||||||
|
|
||||||
|
TS->EmitDirectiveHSACodeObjectVersion(1, 0);
|
||||||
|
AMDGPU::IsaVersion ISA = AMDGPU::getIsaVersion(STI->getFeatureBits());
|
||||||
|
TS->EmitDirectiveHSACodeObjectISA(ISA.Major, ISA.Minor, ISA.Stepping,
|
||||||
|
"AMD", "AMDGPU");
|
||||||
|
}
|
||||||
|
|
||||||
void AMDGPUAsmPrinter::EmitFunctionBodyStart() {
|
void AMDGPUAsmPrinter::EmitFunctionBodyStart() {
|
||||||
const AMDGPUSubtarget &STM = MF->getSubtarget<AMDGPUSubtarget>();
|
const AMDGPUSubtarget &STM = MF->getSubtarget<AMDGPUSubtarget>();
|
||||||
SIProgramInfo KernelInfo;
|
SIProgramInfo KernelInfo;
|
||||||
|
@ -182,13 +201,6 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||||
if (!STM.isAmdHsaOS()) {
|
if (!STM.isAmdHsaOS()) {
|
||||||
EmitProgramInfoSI(MF, KernelInfo);
|
EmitProgramInfoSI(MF, KernelInfo);
|
||||||
}
|
}
|
||||||
// Emit directives
|
|
||||||
AMDGPUTargetStreamer *TS =
|
|
||||||
static_cast<AMDGPUTargetStreamer *>(OutStreamer->getTargetStreamer());
|
|
||||||
TS->EmitDirectiveHSACodeObjectVersion(1, 0);
|
|
||||||
AMDGPU::IsaVersion ISA = STM.getIsaVersion();
|
|
||||||
TS->EmitDirectiveHSACodeObjectISA(ISA.Major, ISA.Minor, ISA.Stepping,
|
|
||||||
"AMD", "AMDGPU");
|
|
||||||
} else {
|
} else {
|
||||||
EmitProgramInfoR600(MF);
|
EmitProgramInfoR600(MF);
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,8 @@ public:
|
||||||
|
|
||||||
void EmitGlobalVariable(const GlobalVariable *GV) override;
|
void EmitGlobalVariable(const GlobalVariable *GV) override;
|
||||||
|
|
||||||
|
void EmitStartOfAsmFile(Module &M) override;
|
||||||
|
|
||||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||||
unsigned AsmVariant, const char *ExtraCode,
|
unsigned AsmVariant, const char *ExtraCode,
|
||||||
raw_ostream &O) override;
|
raw_ostream &O) override;
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=kaveri | FileCheck --check-prefix=HSA --check-prefix=HSA-CI %s
|
||||||
|
; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=carrizo | FileCheck --check-prefix=HSA --check-prefix=HSA-VI %s
|
||||||
|
|
||||||
|
; HSA: .hsa_code_object_version 1,0
|
||||||
|
; HSA-CI: .hsa_code_object_isa 7,0,0,"AMD","AMDGPU"
|
||||||
|
; HSA-VI: .hsa_code_object_isa 8,0,1,"AMD","AMDGPU"
|
Loading…
Reference in New Issue