LLVM: lib/Target/DirectX/DXILFinalizeLinkage.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

15

16#define DEBUG_TYPE "dxil-finalize-linkage"

17

18using namespace llvm;

19

21 bool MadeChange = false;

22

23

24

26 GV.removeDeadConstantUsers();

27 if (GV.hasPrivateLinkage() || (GV.hasExternalLinkage() && GV.use_empty())) {

29 MadeChange = true;

30 }

31 }

32

34

35

36 for (Function &EF : M.functions()) {

37 if (EF.isIntrinsic())

38 continue;

39 if (EF.hasExternalLinkage() && EF.hasDefaultVisibility())

40 continue;

41 if (EF.hasFnAttribute("hlsl.shader"))

42 continue;

44 }

45

49 MadeChange = true;

50 }

51 if (F->isDefTriviallyDead()) {

52 M.getFunctionList().erase(F);

53 MadeChange = true;

54 }

55 }

56

57 return MadeChange;

58}

59

66

70

72

74 "DXIL Finalize Linkage", false, false)

77

static bool finalizeLinkage(Module &M)

Definition DXILFinalizeLinkage.cpp:20

Module.h This file contains the declarations for the Module class.

#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)

#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)

bool runOnModule(Module &M) override

runOnModule - Virtual method overriden by subclasses to process the module being operated on.

Definition DXILFinalizeLinkage.cpp:67

PreservedAnalyses run(Module &M, ModuleAnalysisManager &)

Definition DXILFinalizeLinkage.cpp:60

@ InternalLinkage

Rename collisions when linking (static functions).

@ ExternalLinkage

Externally visible function.

ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...

A Module instance is used to store all the information related to an LLVM module.

A set of analyses that are preserved following a run of a transformation pass.

static PreservedAnalyses none()

Convenience factory function for the empty preserved set.

static PreservedAnalyses all()

Construct a special preserved set that preserves all passes.

void push_back(const T &Elt)

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

This is an optimization pass for GlobalISel generic memory operations.

ModulePass * createDXILFinalizeLinkageLegacyPass()

Pass to finalize linkage of functions.

Definition DXILFinalizeLinkage.cpp:78

AnalysisManager< Module > ModuleAnalysisManager

Convenience typedef for the Module analysis manager.