1 //===- DXILFinalizeLinkage.h - Finalize linkage of functions --------------===// 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 /// DXILFinalizeLinkage pass updates the linkage of functions to make sure only 10 /// shader entry points and exported functions are visible from the module (have 11 /// program linkage). All other functions will be updated to have internal 12 /// linkage. 13 /// 14 //===----------------------------------------------------------------------===// 15 16 #ifndef LLVM_TARGET_DIRECTX_DXILFINALIZELINKAGE_H 17 #define LLVM_TARGET_DIRECTX_DXILFINALIZELINKAGE_H 18 19 #include "llvm/IR/PassManager.h" 20 #include "llvm/Pass.h" 21 22 namespace llvm { 23 24 class DXILFinalizeLinkage : public PassInfoMixin<DXILFinalizeLinkage> { 25 public: 26 PreservedAnalyses run(Module &M, ModuleAnalysisManager &); isRequired()27 static bool isRequired() { return true; } 28 }; 29 30 class DXILFinalizeLinkageLegacy : public ModulePass { 31 public: DXILFinalizeLinkageLegacy()32 DXILFinalizeLinkageLegacy() : ModulePass(ID) {} 33 bool runOnModule(Module &M) override; 34 35 static char ID; // Pass identification. 36 }; 37 } // namespace llvm 38 39 #endif // LLVM_TARGET_DIRECTX_DXILFINALIZELINKAGE_H 40