LLVM: include/llvm/SandboxIR/User.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_SANDBOXIR_USER_H

10#define LLVM_SANDBOXIR_USER_H

11

17

19

21

22

23

24class OperandUseIterator {

26

28 friend class User;

29#define DEF_INSTR(ID, OPC, CLASS) friend class CLASS;

30#include "llvm/SandboxIR/Values.def"

31

32public:

38

43 auto Copy = *this;

45 return Copy;

46 }

48 return Use == Other.Use;

49 }

51 return !(*this == Other);

52 }

56};

57

58

60protected:

62

63

64

65

66

67 Use getOperandUseDefault(unsigned OpIdx, bool Verify) const;

68

69

70

73

74

75

77 return Use.LLVMUse->getOperandNo();

78 }

79

82

90

91#ifndef NDEBUG

92 void verifyUserOfLLVMUse(const llvm::Use &Use) const;

93#endif

94

95public:

96

102

116 return const_cast<User *>(this)->op_end();

117 }

118

124

125

132

133 virtual void setOperand(unsigned OperandIdx, Value *Operand);

134

135

136 bool replaceUsesOfWith(Value *FromV, Value *ToV);

137

138#ifndef NDEBUG

142 void dumpCommonHeader(raw_ostream &OS) const final;

146#endif

147};

148

149}

150

151#endif

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

MachineInstr unsigned OpIdx

ppc ctr loops PowerPC CTR Loops Verify

A Use represents the edge between a Value definition and its users.

LLVM Value Representation.

A range adaptor for a pair of iterators.

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

Iterator for the Use edges of a User's operands.

Definition User.h:24

OperandUseIterator()=default

std::ptrdiff_t difference_type

Definition User.h:33

value_type * pointer

Definition User.h:35

std::input_iterator_tag iterator_category

Definition User.h:37

friend class User

Definition User.h:28

OperandUseIterator operator++(int)

Definition User.h:42

bool operator!=(const OperandUseIterator &Other) const

Definition User.h:50

value_type & reference

Definition User.h:36

bool operator==(const OperandUseIterator &Other) const

Definition User.h:47

LLVM_ABI OperandUseIterator operator-(unsigned Num) const

LLVM_ABI value_type operator*() const

LLVM_ABI OperandUseIterator & operator++()

sandboxir::Use value_type

Definition User.h:34

LLVM_ABI OperandUseIterator operator+(unsigned Num) const

Represents a Def-use/Use-def edge in SandboxIR.

LLVM_ABI unsigned getOperandNo() const

virtual op_iterator op_begin()

Definition User.h:103

void dumpOS(raw_ostream &OS) const override

Definition User.h:143

friend class OperandUseIterator

Definition User.h:72

Value * getOperand(unsigned OpIdx) const

Definition User.h:123

virtual unsigned getUseOperandNo(const Use &Use) const =0

\Returns the operand index of Use.

unsigned getUseOperandNoDefault(const Use &Use) const

The default implementation works only for single-LLVMIR-instruction Users and only if they match exac...

Definition User.h:76

virtual const_op_iterator op_end() const

Definition User.h:115

OperandUseIterator const_op_iterator

Definition User.h:99

op_range operands()

Definition User.h:119

void verify() const override

Should crash if there is something wrong with the instruction.

Definition User.h:139

OperandUseIterator op_iterator

Definition User.h:98

const_op_range operands() const

Definition User.h:120

virtual Use getOperandUseInternal(unsigned OpIdx, bool Verify) const =0

\Returns the Use for the OpIdx'th operand.

void swapOperandsInternal(unsigned OpIdxA, unsigned OpIdxB)

Definition User.h:83

virtual unsigned getNumOperands() const

Definition User.h:129

virtual const_op_iterator op_begin() const

Definition User.h:112

Use getOperandUse(unsigned OpIdx) const

\Returns the operand edge for OpIdx.

Definition User.h:126

iterator_range< const_op_iterator > const_op_range

Definition User.h:101

virtual op_iterator op_end()

Definition User.h:107

iterator_range< op_iterator > op_range

Definition User.h:100

User(ClassID ID, llvm::Value *V, Context &Ctx)

Definition User.h:61

A SandboxIR Value has users. This is the base class.

llvm::Value * Val

The LLVM Value that corresponds to this SandboxIR Value.

Context & Ctx

All values point to the context.

LLVM_ABI Value(ClassID SubclassID, llvm::Value *Val, Context &Ctx)

unsigned ID

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

static bool classof(const Value *From)

For isa/dyn_cast.

iterator_range< T > make_range(T x, T y)

Convenience function for iterating over sub-ranges.

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

decltype(auto) cast(const From &Val)

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