aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
diff options
context:
space:
mode:
authorChris Bieneman <chris.bieneman@me.com>2022-10-18 11:42:09 -0500
committerChris Bieneman <chris.bieneman@me.com>2022-10-18 11:48:08 -0500
commit6e05c8dfc86cb9d1161784f4bfaf4f89709249d5 (patch)
treeba053238ef2a2a29a0ebca7e243e6a11ee0aac94 /llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
parent4a687efecb825f8c1c3e10ffc7949f4b2cd3c1bd (diff)
downloadllvm-6e05c8dfc86cb9d1161784f4bfaf4f89709249d5.zip
llvm-6e05c8dfc86cb9d1161784f4bfaf4f89709249d5.tar.gz
llvm-6e05c8dfc86cb9d1161784f4bfaf4f89709249d5.tar.bz2
[DX] Create globals for DXContainer parts
DXContainer files have a handful of sections that need to be written. This adds a pass to write the section data into IR globals, and writes the shader flag data into a global. The test cases here verify that the shader flags are correctly written from the IR into the global and emitted to the DXContainer. This change also fixes a bug in the MCDXContainerWriter, where the size of the dxbc::ProgramHeader was not being included in the part offset calcuations. This is verified to be working by the new testcases where obj2yaml can properly dump part data for parts after the DXIL part. Resolves issue #57742 (https://github.com/llvm/llvm-project/issues/57742) Reviewed By: python3kgae Differential Revision: https://reviews.llvm.org/D135793
Diffstat (limited to 'llvm/lib/Target/DirectX/DirectXTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/DirectX/DirectXTargetMachine.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp b/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
index 8223639..7031b66 100644
--- a/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
+++ b/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
@@ -43,6 +43,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeDirectXTarget() {
initializeDXILOpLoweringLegacyPass(*PR);
initializeDXILTranslateMetadataPass(*PR);
initializeDXILResourceWrapperPass(*PR);
+ initializeShaderFlagsAnalysisWrapperPass(*PR);
}
class DXILTargetObjectFile : public TargetLoweringObjectFile {
@@ -126,6 +127,9 @@ bool DirectXTargetMachine::addPassesToEmitFile(
if (TargetPassConfig::willCompleteCodeGenPipeline()) {
PM.add(createDXILEmbedderPass());
+ // We embed the other DXContainer globals after embedding DXIL so that the
+ // globals don't pollute the DXIL.
+ PM.add(createDXContainerGlobalsPass());
}
switch (FileType) {
case CGFT_AssemblyFile: