mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 10:46:07 +00:00
[mlir] Update CallInterfaceCallable to use the new casting infra.
This enables casting LLVM style for mlir::CallInterfaceCallable usage. Differential Revision: https://reviews.llvm.org/D135823
This commit is contained in:
parent
0d253bbd33
commit
e750c41ec1
@ -28,4 +28,12 @@ struct CallInterfaceCallable : public PointerUnion<SymbolRefAttr, Value> {
|
||||
/// Include the generated interface declarations.
|
||||
#include "mlir/Interfaces/CallInterfaces.h.inc"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
template <typename To>
|
||||
struct CastInfo<To, mlir::CallInterfaceCallable>
|
||||
: public CastInfo<To, mlir::CallInterfaceCallable::PointerUnion> {};
|
||||
|
||||
} // namespace llvm
|
||||
|
||||
#endif // MLIR_INTERFACES_CALLINTERFACES_H
|
||||
|
@ -21,7 +21,7 @@ using namespace mlir;
|
||||
Operation *
|
||||
CallOpInterface::resolveCallable(SymbolTableCollection *symbolTable) {
|
||||
CallInterfaceCallable callable = getCallableForCallee();
|
||||
if (auto symbolVal = callable.dyn_cast<Value>())
|
||||
if (auto symbolVal = dyn_cast<Value>(callable))
|
||||
return symbolVal.getDefiningOp();
|
||||
|
||||
// If the callable isn't a value, lookup the symbol reference.
|
||||
|
@ -344,7 +344,7 @@ static void collectCallOps(iterator_range<Region::iterator> blocks,
|
||||
if (auto call = dyn_cast<CallOpInterface>(op)) {
|
||||
// TODO: Support inlining nested call references.
|
||||
CallInterfaceCallable callable = call.getCallableForCallee();
|
||||
if (SymbolRefAttr symRef = callable.dyn_cast<SymbolRefAttr>()) {
|
||||
if (SymbolRefAttr symRef = dyn_cast<SymbolRefAttr>(callable)) {
|
||||
if (!symRef.isa<FlatSymbolRefAttr>())
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user