Skip to content

Commit 2d324df

Browse files
author
Simon Camphausen
committed
Review comments
1 parent da1e17d commit 2d324df

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

mlir/include/mlir/Dialect/EmitC/IR/EmitC.td

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -839,10 +839,14 @@ def EmitC_LogicalOrOp : EmitC_BinaryOp<"logical_or", [CExpression]> {
839839
def EmitC_LValueLoadOp : EmitC_Op<"lvalue_load", [
840840
TypesMatchWith<"result type matches value type of 'operand'",
841841
"operand", "result",
842-
"::llvm::cast<LValueType>($_self).getValue()">
842+
"::llvm::cast<LValueType>($_self).getValueType()">
843843
]> {
844844
let summary = "Load an lvalue into an SSA value.";
845-
let description = [{}];
845+
let description = [{
846+
This operation loads the content of a modifiable lvalue into an SSA value.
847+
Modifications of the lvalue executed after the load are not observable on
848+
the produced value.
849+
}];
846850

847851
let arguments = (ins
848852
Res<EmitC_LValueType, "", [MemRead<DefaultResource, 0, FullEffect>]>:$operand);
@@ -1198,7 +1202,7 @@ def EmitC_AssignOp : EmitC_Op<"assign", []> {
11981202

11991203
let arguments = (ins
12001204
Res<EmitC_LValueType, "", [MemWrite<DefaultResource, 1, FullEffect>]>:$var,
1201-
Res<EmitCType, "", [MemRead<DefaultResource, 0, FullEffect>]>:$value);
1205+
EmitCType:$value);
12021206
let results = (outs);
12031207

12041208
let hasVerifier = 1;

mlir/include/mlir/Dialect/EmitC/IR/EmitCTypes.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ def EmitC_LValueType : EmitC_Type<"LValue", "lvalue"> {
9191
Values of this type can be assigned to and their address can be taken.
9292
}];
9393

94-
let parameters = (ins "Type":$value);
94+
let parameters = (ins "Type":$valueType);
9595
let builders = [
96-
TypeBuilderWithInferredContext<(ins "Type":$value), [{
97-
return $_get(value.getContext(), value);
96+
TypeBuilderWithInferredContext<(ins "Type":$valueType), [{
97+
return $_get(valueType.getContext(), valueType);
9898
}]>
9999
];
100-
let assemblyFormat = "`<` qualified($value) `>`";
100+
let assemblyFormat = "`<` qualified($valueType) `>`";
101101
let genVerifyDecl = 1;
102102
}
103103

mlir/lib/Conversion/SCFToEmitC/SCFToEmitC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static void assignValues(ValueRange values, SmallVector<Value> &variables,
8484
SmallVector<Value> loadValues(const SmallVector<Value> &variables,
8585
PatternRewriter &rewriter, Location loc) {
8686
return llvm::map_to_vector<>(variables, [&](Value var) {
87-
Type type = cast<emitc::LValueType>(var.getType()).getValue();
87+
Type type = cast<emitc::LValueType>(var.getType()).getValueType();
8888
return rewriter.create<emitc::LValueLoadOp>(loc, type, var).getResult();
8989
});
9090
}
@@ -138,7 +138,7 @@ LogicalResult ForLowering::matchAndRewrite(ForOp forOp,
138138
lowerYield(resultVariables, rewriter,
139139
cast<scf::YieldOp>(loweredBody->getTerminator()));
140140

141-
// Copy iterArgs into results after the for loop.
141+
// Load variables into SSA values after the for loop.
142142
SmallVector<Value> resultValues = loadValues(resultVariables, rewriter, loc);
143143

144144
rewriter.replaceOp(forOp, resultValues);

mlir/lib/Dialect/EmitC/IR/EmitC.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static LogicalResult verifyInitializationAttribute(Operation *op,
149149

150150
Type resultType = op->getResult(0).getType();
151151
if (auto lType = dyn_cast<LValueType>(resultType))
152-
resultType = lType.getValue();
152+
resultType = lType.getValueType();
153153
Type attrType = cast<TypedAttr>(value).getType();
154154

155155
if (isPointerWideType(resultType) && attrType.isIndex())
@@ -229,7 +229,7 @@ LogicalResult emitc::AssignOp::verify() {
229229
return emitOpError() << "cannot assign to block argument";
230230

231231
Type valueType = getValue().getType();
232-
Type variableType = variable.getType().getValue();
232+
Type variableType = variable.getType().getValueType();
233233
if (variableType != valueType)
234234
return emitOpError() << "requires value's type (" << valueType
235235
<< ") to match variable's type (" << variableType
@@ -862,7 +862,7 @@ LogicalResult emitc::SubscriptOp::verify() {
862862
}
863863
// Check element type.
864864
Type elementType = arrayType.getElementType();
865-
Type resultType = getType().getValue();
865+
Type resultType = getType().getValueType();
866866
if (elementType != resultType) {
867867
return emitOpError() << "on array operand requires element type ("
868868
<< elementType << ") and result type (" << resultType
@@ -889,7 +889,7 @@ LogicalResult emitc::SubscriptOp::verify() {
889889
}
890890
// Check pointee type.
891891
Type pointeeType = pointerType.getPointee();
892-
Type resultType = getType().getValue();
892+
Type resultType = getType().getValueType();
893893
if (pointeeType != resultType) {
894894
return emitOpError() << "on pointer operand requires pointee type ("
895895
<< pointeeType << ") and result type (" << resultType
@@ -1144,9 +1144,9 @@ GetGlobalOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
11441144

11451145
// global has non-array type
11461146
auto lvalueType = dyn_cast<LValueType>(resultType);
1147-
if (!lvalueType || lvalueType.getValue() != globalType)
1147+
if (!lvalueType || lvalueType.getValueType() != globalType)
11481148
return emitOpError("on non-array type expects result inner type ")
1149-
<< lvalueType.getValue() << " to match type " << globalType
1149+
<< lvalueType.getValueType() << " to match type " << globalType
11501150
<< " of the global @" << getName();
11511151
return success();
11521152
}

mlir/lib/Target/Cpp/TranslateToCpp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ LogicalResult CppEmitter::emitType(Location loc, Type type) {
16471647
return success();
16481648
}
16491649
if (auto lType = dyn_cast<emitc::LValueType>(type))
1650-
return emitType(loc, lType.getValue());
1650+
return emitType(loc, lType.getValueType());
16511651
if (auto pType = dyn_cast<emitc::PointerType>(type)) {
16521652
if (isa<ArrayType>(pType.getPointee()))
16531653
return emitError(loc, "cannot emit pointer to array type ") << type;

0 commit comments

Comments
 (0)