summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
diff options
context:
space:
mode:
authorTim Renouf <tpr.llvm@botech.co.uk>2017-10-03 19:03:52 +0000
committerTim Renouf <tpr.llvm@botech.co.uk>2017-10-03 19:03:52 +0000
commit72800f0436e8420a96f54f48b187a58c161317db (patch)
tree4df7e409ed68a6c30a0493e15f8d6badd62b9f5c /llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
parent46513965842fc117f3afb0c8ee2fb0fd329d78ae (diff)
downloadbcm5719-llvm-72800f0436e8420a96f54f48b187a58c161317db.tar.gz
bcm5719-llvm-72800f0436e8420a96f54f48b187a58c161317db.zip
[AMDGPU] implemented pal metadata
Summary: For the amdpal OS type: We write an AMDGPU_PAL_METADATA record in the .note section in the ELF (or as an assembler directive). It contains key=value pairs of 32 bit ints. It is a merge of metadata from codegen of the shaders, and metadata provided by the frontend as _amdgpu_pal_metadata IR metadata. Where both sources have a key=value with the same key, the two values are ORed together. This .note record is part of the amdpal ABI and will be documented in docs/AMDGPUUsage.rst in a future commit. Eventually the amdpal OS type will stop generating the .AMDGPU.config section once the frontend has safely moved over to using the .note records above instead of .AMDGPU.config. Reviewers: arsenm, nhaehnle, dstuttard Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, t-tye Differential Revision: https://reviews.llvm.org/D37753 llvm-svn: 314829
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp')
-rw-r--r--llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index 6b5e4da50f5..fa7157bb645 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -833,6 +833,7 @@ private:
bool ParseDirectiveAMDKernelCodeT();
bool subtargetHasRegister(const MCRegisterInfo &MRI, unsigned RegNo) const;
bool ParseDirectiveAMDGPUHsaKernel();
+ bool ParseDirectivePalMetadata();
bool AddNextRegisterToList(unsigned& Reg, unsigned& RegWidth,
RegisterKind RegKind, unsigned Reg1,
unsigned RegNum);
@@ -2493,6 +2494,21 @@ bool AMDGPUAsmParser::ParseDirectiveAMDGPUHsaKernel() {
return false;
}
+bool AMDGPUAsmParser::ParseDirectivePalMetadata() {
+ std::vector<uint32_t> Data;
+ for (;;) {
+ uint32_t Value;
+ if (ParseAsAbsoluteExpression(Value))
+ return TokError("invalid value in .amdgpu_pal_metadata");
+ Data.push_back(Value);
+ if (getLexer().isNot(AsmToken::Comma))
+ break;
+ Lex();
+ }
+ getTargetStreamer().EmitPalMetadata(Data);
+ return false;
+}
+
bool AMDGPUAsmParser::ParseDirective(AsmToken DirectiveID) {
StringRef IDVal = DirectiveID.getString();
@@ -2511,6 +2527,9 @@ bool AMDGPUAsmParser::ParseDirective(AsmToken DirectiveID) {
if (IDVal == ".amdgpu_hsa_kernel")
return ParseDirectiveAMDGPUHsaKernel();
+ if (IDVal == ".amdgpu_pal_metadata")
+ return ParseDirectivePalMetadata();
+
return true;
}
OpenPOWER on IntegriCloud