MLIR: lib/Dialect/LLVMIR/IR/LLVMInterfaces.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

14

17

18 using namespace mlir;

20

21

22 template

25 if (!isa(iter))

26 return op->emitOpError("expected op to return array of ")

27 << AttrT::getMnemonic() << " attributes";

28 return success();

29 }

30

31

32

33

34

36 auto iface = cast(op);

37 ArrayAttr accessGroups = iface.getAccessGroupsOrNull();

38 if (!accessGroups)

39 return success();

40

41 return isArrayOf(op, accessGroups);

42 }

43

44

45

46

47

48 LogicalResult

50 auto iface = cast(op);

51

52 if (auto aliasScopes = iface.getAliasScopesOrNull())

53 if (failed(isArrayOf(op, aliasScopes)))

54 return failure();

55

56 if (auto noAliasScopes = iface.getNoAliasScopesOrNull())

57 if (failed(isArrayOf(op, noAliasScopes)))

58 return failure();

59

60 ArrayAttr tags = iface.getTBAATagsOrNull();

61 if (!tags)

62 return success();

63

64 return isArrayOf(op, tags);

65 }

66

67

68

69

70

71 LogicalResult

73 auto iface = cast(op);

74

75 if (auto derefAttr = iface.getDereferenceableOrNull())

79 "expected op to return a single LLVM pointer type");

80

81 return success();

82 }

83

84 SmallVector mlir::LLVM::AtomicCmpXchgOp::getAccessedOperands() {

85 return {getPtr()};

86 }

87

89 return {getPtr()};

90 }

91

93 return {getAddr()};

94 }

95

97 return {getAddr()};

98 }

99

101 return {getDst(), getSrc()};

102 }

103

104 SmallVector mlir::LLVM::MemcpyInlineOp::getAccessedOperands() {

105 return {getDst(), getSrc()};

106 }

107

109 return {getDst(), getSrc()};

110 }

111

113 return {getDst()};

114 }

115

116 SmallVector mlir::LLVM::MemsetInlineOp::getAccessedOperands() {

117 return {getDst()};

118 }

119

121 return llvm::filter_to_vector(getArgOperands(), [](Value arg) {

122 return isa(arg.getType());

123 });

124 }

125

126 #include "mlir/Dialect/LLVMIR/LLVMInterfaces.cpp.inc"

static LogicalResult isArrayOf(Operation *op, ArrayAttr array)

Verifies that all elements of array are instances of Attr.

Attributes are known-constant values of operations.

Operation is the basic unit of execution within MLIR.

OpResult getResult(unsigned idx)

Get the 'idx'th result of this operation.

InFlightDiagnostic emitOpError(const Twine &message={})

Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers.

unsigned getNumResults()

Return the number of results held by this operation.

This class represents an instance of an SSA value in the MLIR system, representing a computable value...

Type getType() const

Return the type of this value.

LogicalResult verifyAliasAnalysisOpInterface(Operation *op)

Verifies the alias analysis attributes of memory operations that implement the alias analysis interfa...

LogicalResult verifyAccessGroupOpInterface(Operation *op)

Verifies the access groups attribute of memory operations that implement the access group interface.

LogicalResult verifyDereferenceableOpInterface(Operation *op)

Verifies that the operation implementing the dereferenceable interface has exactly one result of LLVM...

Include the generated interface declarations.