[MLIR] AffineExpr lightweight value type for operators
authorNicolas Vasilache <ntv@google.com>
Wed, 3 Oct 2018 22:36:53 +0000 (15:36 -0700)
committerjpienaar <jpienaar@google.com>
Fri, 29 Mar 2019 20:22:21 +0000 (13:22 -0700)
commit9ef87c4b6b59298da87b3d12ffc56d52ae307ebc
tree37463beff848fe38dd6f264612522d900ded05b5
parent4805e629c5ec35a143933e278762f6de24cfa248
[MLIR] AffineExpr lightweight value type for operators

This CL proposes adding MLIRContext* to AffineExpr as discussed previously.
This allows the value class to not require the context in its constructor and
makes it a POD that it makes sense to pass by value everywhere.
A list of other RFC CLs will build on this. The RFC CLs are small incremental
pushes of the API which would be a pretty big change otherwise.

Pushing the thinking a little bit more it seems reasonable to use implicit
cast/constructor to/from AffineExpr*.
As this thing evolves, it looks to me like IR (and
probably Parser, for not so good reasons) want to operate on AffineExpr* and
the rest of the code wants to operate on the value type.

For this reason I think AffineExprImpl*/AffineExpr may also make sense but I
do not have a particular naming preference.
The jury is still out for naming decision between the above and
AffineExprBase*/AffineExpr or AffineExpr*/AffineExprRef.

PiperOrigin-RevId: 215641596
mlir/include/mlir/IR/AffineExpr.h
mlir/lib/IR/AffineExpr.cpp
mlir/lib/IR/Builders.cpp
mlir/lib/IR/MLIRContext.cpp
mlir/lib/Transforms/LoopUtils.cpp