LLVM: lib/CodeGen/SanitizerBinaryMetadata.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

24#include

25

26using namespace llvm;

27

28namespace {

29

30

32public:

33 static char ID;

34

35 MachineSanitizerBinaryMetadataLegacy();

36 bool runOnMachineFunction(MachineFunction &F) override;

37};

38

39struct MachineSanitizerBinaryMetadata {

40 bool run(MachineFunction &MF);

41};

42

43}

44

45INITIALIZE_PASS(MachineSanitizerBinaryMetadataLegacy, "machine-sanmd",

46 "Machine Sanitizer Binary Metadata", false, false)

47

48char MachineSanitizerBinaryMetadataLegacy::ID = 0;

50 MachineSanitizerBinaryMetadataLegacy::ID;

51

52MachineSanitizerBinaryMetadataLegacy::MachineSanitizerBinaryMetadataLegacy()

56}

57

58bool MachineSanitizerBinaryMetadataLegacy::runOnMachineFunction(

60 return MachineSanitizerBinaryMetadata().run(MF);

61}

62

63PreservedAnalyses

66 if (!MachineSanitizerBinaryMetadata().run(MF))

68

70}

71

72bool MachineSanitizerBinaryMetadata::run(MachineFunction &MF) {

74 if (!MD)

75 return false;

78 return false;

80

81 assert(AuxMDs.getNumOperands() == 1);

85 return false;

86

87 int64_t Size = 0;

93 }

96 return false;

97

101

104 F.setMetadata(

105 LLVMContext::MD_pcsections,

106 MDB.createPCSections({{Section.getString(),

107 {IRB.getInt(NewFeatures), IRB.getInt32(Size)}}}));

108 return false;

109}

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

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

Class for arbitrary precision integers.

void setBit(unsigned BitPosition)

Set the given bit to 1 whose position is given as "bitPosition".

This is an important base class in LLVM.

LLVM_ABI const APInt & getUniqueInteger() const

If C is a constant integer then return its value, otherwise C must be a vector of constant integers,...

MDNode * getMetadata(unsigned KindID) const

Get the current metadata attachments for the given kind, if any.

This provides a uniform API for creating instructions and inserting them into a basic block: either a...

const MDOperand & getOperand(unsigned I) const

The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.

Align getObjectAlign(int ObjectIdx) const

Return the alignment of the specified stack object.

int64_t getObjectSize(int ObjectIdx) const

Return the size of the specified object.

unsigned getNumFixedObjects() const

Return the number of fixed objects.

int64_t getObjectOffset(int ObjectIdx) const

Return the assigned stack offset of the specified object from the incoming stack pointer.

MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...

MachineFrameInfo & getFrameInfo()

getFrameInfo - Return the frame info object for the current function.

Function & getFunction()

Return the LLVM function that this machine code represents.

static LLVM_ABI PassRegistry * getPassRegistry()

getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...

static PreservedAnalyses all()

Construct a special preserved set that preserves all passes.

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

PointerTypeMap run(const Module &M)

Compute the PointerTypeMap for the module M.

This is an optimization pass for GlobalISel generic memory operations.

AnalysisManager< MachineFunction > MachineFunctionAnalysisManager

LLVM_ABI char & MachineSanitizerBinaryMetadataID

LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()

Returns the minimum set of Analyses that all machine function passes must preserve.

constexpr int kSanitizerBinaryMetadataUARHasSizeBit

constexpr int kSanitizerBinaryMetadataUARBit

constexpr char kSanitizerBinaryMetadataCoveredSection[]

decltype(auto) cast(const From &Val)

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

LLVM_ABI void initializeMachineSanitizerBinaryMetadataLegacyPass(PassRegistry &)

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

constexpr uint64_t value() const

This is a hole in the type system and should not be abused.