CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
87 lines
2.6 KiB
C++
87 lines
2.6 KiB
C++
//===- llvm/MC/DXContainerInfo.cpp - DXContainer Info -----*- C++ -------*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/MC/DXContainerInfo.h"
|
|
#include "llvm/ADT/SmallString.h"
|
|
#include "llvm/BinaryFormat/DXContainer.h"
|
|
#include "llvm/Config/config.h"
|
|
#include "llvm/Support/SwapByteOrder.h"
|
|
#include "llvm/Support/VCSRevision.h"
|
|
#include <type_traits>
|
|
|
|
using namespace llvm;
|
|
using namespace llvm::mcdxbc;
|
|
|
|
template <typename StructT>
|
|
static void writeStruct(raw_ostream &OS, StructT S) {
|
|
static_assert(std::is_class<StructT>() &&
|
|
"This method must be used for writing structure types");
|
|
if (sys::IsBigEndianHost)
|
|
S.swapBytes();
|
|
OS.write(reinterpret_cast<const char *>(&S), sizeof(StructT));
|
|
}
|
|
|
|
static void writeString(raw_ostream &OS, StringRef S) {
|
|
OS.write(S.data(), S.size());
|
|
// Write null terminator.
|
|
OS.write_zeros(1);
|
|
}
|
|
|
|
void DebugName::setFilename(StringRef DebugFilename) {
|
|
Parameters.NameLength = DebugFilename.size();
|
|
Filename = DebugFilename;
|
|
}
|
|
|
|
void DebugName::write(raw_ostream &OS) const {
|
|
writeStruct(OS, Parameters);
|
|
writeString(OS, Filename.substr(0, Parameters.NameLength));
|
|
}
|
|
|
|
CompilerVersion::CompilerVersion() {
|
|
Parameters.Major = LLVM_VERSION_MAJOR;
|
|
Parameters.Minor = LLVM_VERSION_MINOR;
|
|
Parameters.Flags = dxbc::CompilerVersionFlags::Default;
|
|
#ifndef NDEBUG
|
|
Parameters.Flags |= dxbc::CompilerVersionFlags::Debug;
|
|
#endif
|
|
Parameters.CommitCount = 0;
|
|
Parameters.ContentSizeInBytes = 0;
|
|
#ifdef LLVM_REVISION
|
|
CommitSha = LLVM_REVISION;
|
|
#else
|
|
CommitSha = "";
|
|
#endif
|
|
CustomVersionString = PACKAGE_VERSION;
|
|
updateContentSize();
|
|
}
|
|
|
|
void CompilerVersion::setCommitSha(StringRef CommitSha) {
|
|
this->CommitSha = CommitSha;
|
|
updateContentSize();
|
|
}
|
|
|
|
void CompilerVersion::setVersionString(StringRef VersionString) {
|
|
this->CustomVersionString = VersionString;
|
|
updateContentSize();
|
|
}
|
|
|
|
void CompilerVersion::updateContentSize() {
|
|
this->Parameters.ContentSizeInBytes =
|
|
CommitSha.size() + 1 + CustomVersionString.size() + 1;
|
|
}
|
|
|
|
void CompilerVersion::write(raw_ostream &OS) const {
|
|
writeStruct(OS, Parameters);
|
|
SmallString<64> Content;
|
|
raw_svector_ostream ContentStream(Content);
|
|
writeString(ContentStream, CommitSha);
|
|
writeString(ContentStream, CustomVersionString);
|
|
Content.resize(Parameters.ContentSizeInBytes);
|
|
OS.write(Content.data(), Parameters.ContentSizeInBytes);
|
|
}
|