LLVM: include/llvm/MCA/SourceMgr.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_MCA_SOURCEMGR_H

15#define LLVM_MCA_SOURCEMGR_H

16

19

20namespace llvm {

21namespace mca {

22

23

24

25typedef std::pair<unsigned, const Instruction &> SourceRef;

26

27

28

30 using UniqueInst = std::unique_ptr;

31

32

34

35

36

38

39

40

41

43

44

45 virtual bool isEnd() const = 0;

46

47

49

50

52

54};

55

56

57

58

61 unsigned Current;

62 const unsigned Iterations;

63 static const unsigned DefaultIterations = 100;

64

65public:

67 : Sequence(S), Current(0U), Iterations(Iter ? Iter : DefaultIterations) {}

68

70

73 return Current < (Iterations * Sequence.size());

74 }

76

78 assert(hasNext() && "Already at end of sequence!");

79 return SourceRef(Current, *Sequence[Current % Sequence.size()]);

80 }

81

83};

84

85}

86}

87

88#endif

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

This file defines abstractions used by the Pipeline to model register reads, register writes and inst...

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

size_t size() const

size - Get the array size.

void updateNext() override

Advance to the next SourceRef.

Definition SourceMgr.h:82

SourceRef peekNext() const override

The next SourceRef.

Definition SourceMgr.h:77

CircularSourceMgr(ArrayRef< UniqueInst > S, unsigned Iter)

Definition SourceMgr.h:66

bool hasNext() const override

Whether there is any SourceRef to inspect / peek next.

Definition SourceMgr.h:72

ArrayRef< UniqueInst > getInstructions() const override

Provides a fixed range of UniqueInst to iterate.

Definition SourceMgr.h:69

bool isEnd() const override

Whether the instruction stream has eneded.

Definition SourceMgr.h:75

unsigned getNumIterations() const

Definition SourceMgr.h:71

std::pair< unsigned, const Instruction & > SourceRef

Definition SourceMgr.h:25

This is an optimization pass for GlobalISel generic memory operations.

Abstracting the input code sequence (a sequence of MCInst) and assigning unique identifiers to every ...

Definition SourceMgr.h:29

virtual void updateNext()=0

Advance to the next SourceRef.

virtual ~SourceMgr()=default

virtual size_t size() const

(Fixed) Number of UniqueInst.

Definition SourceMgr.h:37

virtual ArrayRef< UniqueInst > getInstructions() const =0

Provides a fixed range of UniqueInst to iterate.

virtual bool isEnd() const =0

Whether the instruction stream has eneded.

std::unique_ptr< Instruction > UniqueInst

Definition SourceMgr.h:30

virtual SourceRef peekNext() const =0

The next SourceRef.

virtual bool hasNext() const =0

Whether there is any SourceRef to inspect / peek next.