LLVM: lib/Transforms/Utils/Instrumentation.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

20

21using namespace llvm;

22

24 "ignore-redundant-instrumentation",

26

27

29 if (!M.getModuleFlag(Flag)) {

31 return false;

32 }

34 return true;

35 std::string diagInfo =

36 "Redundant instrumentation detected, with module flag: " +

37 std::string(Flag);

38 M.getContext().diagnose(

40 return true;

41}

42

43

46

47 if (I == IP) {

48 ++IP;

49 } else {

50

51 I->moveBefore(IP);

52 }

53 return IP;

54}

55

56

57

58

59

60

64 for (auto I = IP, E = BB.end(); I != E; ++I) {

65 bool KeepInEntry = false;

67 if (AI->isStaticAlloca())

68 KeepInEntry = true;

70 if (II->getIntrinsicID() == llvm::Intrinsic::localescape)

71 KeepInEntry = true;

72 }

73 if (KeepInEntry)

75 }

76 return IP;

77}

78

79

81 bool AllowMerging,

82 Twine NamePrefix) {

84

85

89 if (AllowMerging)

91 GV->setAlignment(Align(1));

92

93 return GV;

94}

95

97 if (auto Comdat = F.getComdat())

100 Module *M = F.getParent();

101

102

103

104

105 Comdat *C = M->getOrInsertComdat(F.getName());

106 if (T.isOSBinFormatELF() || (T.isOSBinFormatCOFF() && F.isWeakForLinker()))

108 F.setComdat(C);

109 return C;

110}

111

114

117 return;

118

121 return;

123}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

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

static cl::opt< bool > ClIgnoreRedundantInstrumentation("ignore-redundant-instrumentation", cl::desc("Ignore redundant instrumentation"), cl::Hidden, cl::init(false))

static BasicBlock::iterator moveBeforeInsertPoint(BasicBlock::iterator I, BasicBlock::iterator IP)

Moves I before IP. Returns new insert point.

Definition Instrumentation.cpp:44

uint64_t IntrinsicInst * II

LLVM Basic Block Representation.

const Function * getParent() const

Return the enclosing method, or null if none.

InstListType::iterator iterator

Instruction iterators...

@ NoDeduplicate

No deduplication is performed.

static LLVM_ABI Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)

This method constructs a CDS and initializes it with a text string.

This is an important base class in LLVM.

Diagnostic information for IR instrumentation reporting.

const BasicBlock & getEntryBlock() const

void setUnnamedAddr(UnnamedAddr Val)

Module * getParent()

Get the module that this global value is contained inside of...

@ PrivateLinkage

Like Internal, but omit from symbol table.

LLVM_ABI void setCodeModel(CodeModel::Model CM)

Change the code model for this global.

void setAlignment(Align Align)

Sets the alignment attribute of the GlobalVariable.

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

@ Override

Uses the specified value, regardless of the behavior or value of the other module.

std::optional< CodeModel::Model > getCodeModel() const

Returns the code model (tiny, small, kernel, medium or large model)

StringRef - Represent a constant reference to a string, i.e.

Triple - Helper class for working with autoconf configuration names.

ObjectFormatType getObjectFormat() const

Get the object format for this triple.

ArchType getArch() const

Get the parsed architecture type of this triple.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

Type * getType() const

All values are typed, get the type of this value.

@ C

The default llvm calling convention, compatible with C.

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI GlobalVariable * createPrivateGlobalForString(Module &M, StringRef Str, bool AllowMerging, Twine NamePrefix="")

Definition Instrumentation.cpp:80

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

LLVM_ABI Comdat * getOrCreateFunctionComdat(Function &F, Triple &T)

Definition Instrumentation.cpp:96

LLVM_ABI void setGlobalVariableLargeSection(const Triple &TargetTriple, GlobalVariable &GV)

Definition Instrumentation.cpp:112

LLVM_ABI BasicBlock::iterator PrepareToSplitEntryBlock(BasicBlock &BB, BasicBlock::iterator IP)

Instrumentation passes often insert conditional checks into entry blocks.

Definition Instrumentation.cpp:61

LLVM_ABI bool checkIfAlreadyInstrumented(Module &M, StringRef Flag)

Check if module has flag attached, if not add the flag.

Definition Instrumentation.cpp:28

This struct is a compact representation of a valid (non-zero power of two) alignment.