Refactor FunctionAttr to hold the internal function reference by name instead...
authorRiver Riddle <riverriddle@google.com>
Wed, 22 May 2019 20:41:23 +0000 (13:41 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 02:56:54 +0000 (19:56 -0700)
commitc33862b0ed8c7b07160470c86ad281d777bfcd13
tree48f79d5259739aa078b172de0301eef8e96a73cb
parentd5397f4efe126c5fa1cebf9634d8c1e12d21ec56
Refactor FunctionAttr to hold the internal function reference by name instead of pointer. The one downside to this is that the function reference held by a FunctionAttr needs to be explicitly looked up from the parent module. This provides several benefits though:
    * There is no longer a need to explicitly remap function attrs.
      - This removes a potentially expensive call from the destructor of Function.
      - This will enable some interprocedural transformations to now run intraprocedurally.
      - This wasn't scalable and forces dialect defined attributes to override
        a virtual function.
    * Replacing a function is now a trivial operation.
    * This is a necessary first step to representing functions as operations.

--

PiperOrigin-RevId: 249510802
32 files changed:
mlir/g3doc/LangRef.md
mlir/include/mlir/IR/AttributeSupport.h
mlir/include/mlir/IR/Attributes.h
mlir/include/mlir/IR/Builders.h
mlir/include/mlir/IR/Function.h
mlir/include/mlir/IR/OpBase.td
mlir/include/mlir/IR/OpImplementation.h
mlir/include/mlir/StandardOps/Ops.td
mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
mlir/include/mlir/Transforms/Utils.h
mlir/lib/Analysis/Verifier.cpp
mlir/lib/GPU/IR/GPUDialect.cpp
mlir/lib/IR/AsmPrinter.cpp
mlir/lib/IR/AttributeDetail.h
mlir/lib/IR/Attributes.cpp
mlir/lib/IR/Builders.cpp
mlir/lib/IR/Function.cpp
mlir/lib/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/Parser/Parser.cpp
mlir/lib/StandardOps/Ops.cpp
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/lib/Transforms/Utils/Utils.cpp
mlir/test/GPU/invalid.mlir
mlir/test/GPU/ops.mlir
mlir/test/IR/core-ops.mlir
mlir/test/IR/invalid-ops.mlir
mlir/test/IR/invalid.mlir
mlir/test/IR/parser.mlir
mlir/test/LLVMIR/convert-funcs.mlir
mlir/test/LLVMIR/roundtrip.mlir
mlir/test/Target/llvmir.mlir
mlir/test/mlir-tblgen/op-attribute.td