[PATCH] D77768: [mlir] Refactor ClassID into a more robust TypeID class.

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 19:01:16 PDT 2020


rriddle created this revision.
rriddle added a reviewer: mehdi_amini.
Herald added subscribers: llvm-commits, frgossen, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, mstorsjo.
Herald added a reviewer: nicolasvasilache.
Herald added a project: LLVM.

ClassID has proved extremely useful in providing a cheap type identifier for various aspects of the infra, the only problem is that the mechanism used doesn't work in certain dynamic library build configurations(i.e. windows DLLs). This revision refactors ClassID to use the type name as a fallback comparator when compiling in those configurations. On platforms that we can set the visibility properly, TypeInfo retains the same performance as a simple pointer identifier.

This has a few cons, but is the only reliable way to ensure a valid type id:

- On necessary platforms, there are at least two comparisons for equality
- Types must have unique names


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77768

Files:
  mlir/docs/WritingAPass.md
  mlir/include/mlir/IR/AttributeSupport.h
  mlir/include/mlir/IR/Dialect.h
  mlir/include/mlir/IR/DialectHooks.h
  mlir/include/mlir/IR/DialectInterface.h
  mlir/include/mlir/IR/Location.h
  mlir/include/mlir/IR/OpDefinition.h
  mlir/include/mlir/IR/OperationSupport.h
  mlir/include/mlir/IR/StorageUniquerSupport.h
  mlir/include/mlir/IR/TypeSupport.h
  mlir/include/mlir/Interfaces/SideEffects.h
  mlir/include/mlir/Pass/AnalysisManager.h
  mlir/include/mlir/Pass/Pass.h
  mlir/include/mlir/Pass/PassInstrumentation.h
  mlir/include/mlir/Pass/PassRegistry.h
  mlir/include/mlir/Support/STLExtras.h
  mlir/include/mlir/Support/TypeID.h
  mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
  mlir/lib/IR/Dialect.cpp
  mlir/lib/IR/Location.cpp
  mlir/lib/IR/LocationDetail.h
  mlir/lib/IR/MLIRContext.cpp
  mlir/lib/Pass/Pass.cpp
  mlir/lib/Pass/PassRegistry.cpp
  mlir/lib/Pass/PassTiming.cpp
  mlir/tools/mlir-tblgen/PassGen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77768.256155.patch
Type: text/x-patch
Size: 53440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200409/98455596/attachment.bin>


More information about the llvm-commits mailing list