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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_MCA_STAGES_STAGE_H

16#define LLVM_MCA_STAGES_STAGE_H

17

21#include

22

23namespace llvm {

24namespace mca {

25

27

29 Stage *NextInSequence = nullptr;

30 std::set<HWEventListener *> Listeners;

31

32 Stage(const Stage &Other) = delete;

33 Stage &operator=(const Stage &Other) = delete;

34

35protected:

36 const std::set<HWEventListener *> &getListeners() const { return Listeners; }

37

38public:

41

42

44

45

47

48

49

51

52

54

55

57

58

60

62 assert(!NextInSequence && "This stage already has a NextInSequence!");

63 NextInSequence = NextStage;

64 }

65

67 return NextInSequence && NextInSequence->isAvailable(IR);

68 }

69

70

71

72

73

76 return NextInSequence->execute(IR);

77 }

78

79

81

82

83 template void notifyEvent(const EventT &Event) const {

85 Listener->onEvent(Event);

86 }

87};

88

89

90

93

97 void log(raw_ostream &OS) const override { OS << "Stream is paused"; }

98};

99}

100}

101#endif

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

This file defines the main interface for hardware event listeners.

Legalize the Machine IR a function s Machine IR

Base class for user error types.

Subclass of Error for the sole purpose of identifying the success path in the type system.

Lightweight error class with error context and mandatory checking.

An InstRef contains both a SourceMgr index and Instruction pair.

virtual Error cycleEnd()

Called once at the end of each cycle.

Definition Stage.h:56

Error moveToTheNextStage(InstRef &IR)

Called when an instruction is ready to move the next pipeline stage.

Definition Stage.h:74

void notifyEvent(const EventT &Event) const

Notify listeners of a particular hardware event.

Definition Stage.h:83

bool checkNextStage(const InstRef &IR) const

Definition Stage.h:66

virtual bool isAvailable(const InstRef &IR) const

Returns true if it can execute IR during this cycle.

Definition Stage.h:43

virtual Error cycleStart()

Called once at the start of each cycle.

Definition Stage.h:50

virtual Error execute(InstRef &IR)=0

The primary action that this stage performs on instruction IR.

const std::set< HWEventListener * > & getListeners() const

Definition Stage.h:36

virtual bool hasWorkToComplete() const =0

Returns true if some instructions are still executing this stage.

void setNextInSequence(Stage *NextStage)

Definition Stage.h:61

virtual Error cycleResume()

Called after the pipeline is resumed from pausing state.

Definition Stage.h:53

This class implements an extremely fast bulk output stream that can only output to a stream.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI std::error_code inconvertibleErrorCode()

The value returned by this function can be returned from convertToErrorCode for Error values where no...

This is actually not an error but a marker to indicate that the instruction stream is paused.

Definition Stage.h:91

static LLVM_ABI char ID

Definition Stage.h:92

std::error_code convertToErrorCode() const override

Convert this error to a std::error_code.

Definition Stage.h:94

void log(raw_ostream &OS) const override

Print an error message to an output stream.

Definition Stage.h:97