LLVM  16.0.0git
DXILTranslateMetadata.cpp
Go to the documentation of this file.
1 //===- DXILTranslateMetadata.cpp - Pass to emit DXIL metadata ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 //===----------------------------------------------------------------------===//
10 
11 #include "DXILMetadata.h"
12 #include "DirectX.h"
13 #include "llvm/ADT/StringSet.h"
14 #include "llvm/ADT/Triple.h"
15 #include "llvm/IR/Constants.h"
16 #include "llvm/IR/Metadata.h"
17 #include "llvm/IR/Module.h"
18 #include "llvm/Pass.h"
19 
20 using namespace llvm;
21 
22 namespace {
23 class DXILTranslateMetadata : public ModulePass {
24 public:
25  static char ID; // Pass identification, replacement for typeid
26  explicit DXILTranslateMetadata() : ModulePass(ID) {}
27 
28  StringRef getPassName() const override { return "DXIL Metadata Emit"; }
29 
30  bool runOnModule(Module &M) override;
31 };
32 
33 } // namespace
34 
35 bool DXILTranslateMetadata::runOnModule(Module &M) {
36 
37  dxil::ValidatorVersionMD ValVerMD(M);
38  if (ValVerMD.isEmpty())
39  ValVerMD.update(VersionTuple(1, 0));
40  return false;
41 }
42 
44 
46  return new DXILTranslateMetadata();
47 }
48 
49 INITIALIZE_PASS(DXILTranslateMetadata, "dxil-metadata-emit",
50  "DXIL Metadata Emit", false, false)
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Metadata.h
llvm::ModulePass
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:248
Pass.h
Module.h
DXILMetadata.h
DirectX.h
llvm::createDXILTranslateMetadataPass
ModulePass * createDXILTranslateMetadataPass()
Pass to emit metadata for DXIL.
Definition: DXILTranslateMetadata.cpp:45
Constants.h
INITIALIZE_PASS
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:37
llvm::VersionTuple
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:31
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::dxil::ValidatorVersionMD
Definition: DXILMetadata.h:22
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
Triple.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
StringSet.h
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38