Introduce a new Location abstraction to represent location data in a structured
(and more useful) way rather than hacking up a pile of attributes for it. In
the future this will grow to represent inlined locations, fusion cases etc, but
for now we start with simple Unknown and File/Line/Col locations. NFC.
PiperOrigin-RevId: 210485775
diff --git a/lib/IR/Statement.cpp b/lib/IR/Statement.cpp
index 3746f71..3f95a94 100644
--- a/lib/IR/Statement.cpp
+++ b/lib/IR/Statement.cpp
@@ -209,7 +209,7 @@
//===----------------------------------------------------------------------===//
/// Create a new OperationStmt with the specific fields.
-OperationStmt *OperationStmt::create(Attribute *location, Identifier name,
+OperationStmt *OperationStmt::create(Location *location, Identifier name,
ArrayRef<MLValue *> operands,
ArrayRef<Type *> resultTypes,
ArrayRef<NamedAttribute> attributes,
@@ -233,7 +233,7 @@
return stmt;
}
-OperationStmt::OperationStmt(Attribute *location, Identifier name,
+OperationStmt::OperationStmt(Location *location, Identifier name,
unsigned numOperands, unsigned numResults,
ArrayRef<NamedAttribute> attributes,
MLIRContext *context)
@@ -275,7 +275,7 @@
// ForStmt
//===----------------------------------------------------------------------===//
-ForStmt *ForStmt::create(Attribute *location, ArrayRef<MLValue *> lbOperands,
+ForStmt *ForStmt::create(Location *location, ArrayRef<MLValue *> lbOperands,
AffineMap *lbMap, ArrayRef<MLValue *> ubOperands,
AffineMap *ubMap, int64_t step, MLIRContext *context) {
assert(lbOperands.size() == lbMap->getNumOperands() &&
@@ -297,7 +297,7 @@
return stmt;
}
-ForStmt::ForStmt(Attribute *location, unsigned numOperands, AffineMap *lbMap,
+ForStmt::ForStmt(Location *location, unsigned numOperands, AffineMap *lbMap,
AffineMap *ubMap, int64_t step, MLIRContext *context)
: Statement(Kind::For, location),
MLValue(MLValueKind::ForStmt, Type::getAffineInt(context)),
@@ -357,7 +357,7 @@
// IfStmt
//===----------------------------------------------------------------------===//
-IfStmt::IfStmt(Attribute *location, IntegerSet *condition)
+IfStmt::IfStmt(Location *location, IntegerSet *condition)
: Statement(Kind::If, location), thenClause(new IfClause(this)),
elseClause(nullptr), condition(condition) {}