HomePhabricator

[AMDGPU] Factored PAL metadata handling out into its own class

Authored by tpr on Mar 20 2019, 10:42 AM.

Description

[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

Event Timeline

Seems to me it causes problems with the shared library builds:
AMDGPUPALMetadata.cpp.o: In function `llvm::AMDGPUPALMetadata::setFromMsgPackBlob(llvm::StringRef)':
llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp:84: undefined reference to `llvm::msgpack::Reader::Reader(llvm::StringRef)'
llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp:85: undefined reference to `llvm::msgpack::Document::readFromBlob(llvm::StringRef, bool)'
...