[AMDGPU] Factored PAL metadata handling out into its own class
authorTim Renouf <tpr.llvm@botech.co.uk>
Wed, 20 Mar 2019 17:42:00 +0000 (17:42 +0000)
committerTim Renouf <tpr.llvm@botech.co.uk>
Wed, 20 Mar 2019 17:42:00 +0000 (17:42 +0000)
commitd737b551e97e9762c22b5188be3e9c3332ebc908
tree74a721aae47511eb718ea0ece6984ef2cdac2078
parent86724e40bfa544a5024a2a3d522934aef6914cc7
[AMDGPU] Factored PAL metadata handling out into its own class

Summary:
This commit introduces a new AMDGPUPALMetadata class that:
* is inside the AMDGPU target;
* keeps an in-memory representation of PAL metadata;
* provides a method to read the frontend-supplied metadata from LLVM IR;
* provides methods for the asm printer to set metadata items;
* provides methods to write the metadata as a binary blob to put in a
  .note record or as an asm directive;
* provides a method to read the metadata as a binary blob from a .note
  record.

Because llvm-readobj cannot call directly into a target, I had to remove
llvm-readobj's ability to dump PAL metadata, pending a resolution to
https://reviews.llvm.org/D52821

Differential Revision: https://reviews.llvm.org/D57027

Change-Id: I756dc830894fcb6850324cdcfa87c0120eb2cf64
llvm-svn: 356582
12 files changed:
llvm/include/llvm/Support/AMDGPUMetadata.h
llvm/lib/Support/AMDGPUMetadata.cpp
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp [new file with mode: 0644]
llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h [new file with mode: 0644]
llvm/lib/Target/AMDGPU/Utils/CMakeLists.txt
llvm/test/CodeGen/AMDGPU/elf-notes.ll
llvm/tools/llvm-readobj/ELFDumper.cpp