| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- ///////////////////////////////////////////////////////////////////////////////
- // //
- // HLMetadataPasses.cpp //
- // Copyright (C) Microsoft Corporation. All rights reserved. //
- // This file is distributed under the University of Illinois Open Source //
- // License. See LICENSE.TXT for details. //
- // //
- ///////////////////////////////////////////////////////////////////////////////
- #include "dxc/HLSL/DxilGenerationPass.h"
- #include "dxc/HLSL/HLModule.h"
- #include "llvm/IR/Module.h"
- #include "llvm/IR/PassManager.h"
- using namespace llvm;
- using namespace hlsl;
- namespace {
- class HLEmitMetadata : public ModulePass {
- public:
- static char ID; // Pass identification, replacement for typeid
- explicit HLEmitMetadata() : ModulePass(ID) {}
- const char *getPassName() const override { return "HLSL High-Level Metadata Emit"; }
- bool runOnModule(Module &M) override {
- if (M.HasHLModule()) {
- HLModule::ClearHLMetadata(M);
- M.GetHLModule().EmitHLMetadata();
- return true;
- }
- return false;
- }
- };
- }
- char HLEmitMetadata::ID = 0;
- ModulePass *llvm::createHLEmitMetadataPass() {
- return new HLEmitMetadata();
- }
- INITIALIZE_PASS(HLEmitMetadata, "hlsl-hlemit", "HLSL High-Level Metadata Emit", false, false)
- ///////////////////////////////////////////////////////////////////////////////
- namespace {
- class HLEnsureMetadata : public ModulePass {
- public:
- static char ID; // Pass identification, replacement for typeid
- explicit HLEnsureMetadata() : ModulePass(ID) {}
- const char *getPassName() const override { return "HLSL High-Level Metadata Ensure"; }
- bool runOnModule(Module &M) override {
- if (!M.HasHLModule()) {
- M.GetOrCreateHLModule();
- return true;
- }
- return false;
- }
- };
- }
- char HLEnsureMetadata::ID = 0;
- ModulePass *llvm::createHLEnsureMetadataPass() {
- return new HLEnsureMetadata();
- }
- INITIALIZE_PASS(HLEnsureMetadata, "hlsl-hlensure", "HLSL High-Level Metadata Ensure", false, false)
|