LLVM: include/llvm/CodeGen/MachineBlockHashInfo.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_CODEGEN_MACHINEBLOCKHASHINFO_H

14#define LLVM_CODEGEN_MACHINEBLOCKHASHINFO_H

15

17

18namespace llvm {

19

20

21

22

24public:

27 : Offset(Offset), OpcodeHash(OpcodeHash), InstrHash(InstrHash),

28 NeighborHash(NeighborHash) {}

29

31 Offset = CombinedHash & 0xffff;

32 CombinedHash >>= 16;

33 OpcodeHash = CombinedHash & 0xffff;

34 CombinedHash >>= 16;

35 InstrHash = CombinedHash & 0xffff;

36 CombinedHash >>= 16;

37 NeighborHash = CombinedHash & 0xffff;

38 }

39

40

43 Hash |= uint64_t(NeighborHash);

44 Hash <<= 16;

46 Hash <<= 16;

48 Hash <<= 16;

50 return Hash;

51 }

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

69 assert(OpcodeHash == BBH.OpcodeHash &&

70 "incorrect blended hash distance computation");

72

73 Dist += NeighborHash == BBH.NeighborHash ? 0 : 1;

74 Dist <<= 16;

75

76 Dist += InstrHash == BBH.InstrHash ? 0 : 1;

77 Dist <<= 16;

78

79 Dist += (Offset >= BBH.Offset ? Offset - BBH.Offset : BBH.Offset - Offset);

80 return Dist;

81 }

82

84

85private:

86

88

90

91

92 uint16_t InstrHash{0};

93

94

95 uint16_t NeighborHash{0};

96};

97

100

101public:

104

106

108

110

112};

113

114}

115

116#endif

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

Represent the analysis usage information of a pass.

bool runOnMachineFunction(MachineFunction &F) override

runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...

static char ID

Definition MachineBlockHashInfo.h:102

StringRef getPassName() const override

getPassName - Return a nice clean name for a pass.

Definition MachineBlockHashInfo.h:105

uint64_t getMBBHash(const MachineBasicBlock &MBB)

void getAnalysisUsage(AnalysisUsage &AU) const override

getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...

MachineFunctionPass(char &ID)

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

This is an optimization pass for GlobalISel generic memory operations.

uint16_t getOpcodeHash() const

Definition MachineBlockHashInfo.h:83

uint64_t distance(const BlendedBlockHash &BBH) const

Compute a distance between two given blended hashes.

Definition MachineBlockHashInfo.h:68

BlendedBlockHash(uint16_t Offset, uint16_t OpcodeHash, uint16_t InstrHash, uint16_t NeighborHash)

Definition MachineBlockHashInfo.h:25

uint64_t combine() const

Combine the blended hash into uint64_t.

Definition MachineBlockHashInfo.h:41

BlendedBlockHash(uint64_t CombinedHash)

Definition MachineBlockHashInfo.h:30