Note that PointerUnion::{is,get} have been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.
36 lines
1.4 KiB
C++
36 lines
1.4 KiB
C++
//===- CallInterfaces.cpp - ControlFlow Interfaces ------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Interfaces/CallInterfaces.h"
|
|
|
|
using namespace mlir;
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// CallOpInterface
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
Operation *
|
|
call_interface_impl::resolveCallable(CallOpInterface call,
|
|
SymbolTableCollection *symbolTable) {
|
|
CallInterfaceCallable callable = call.getCallableForCallee();
|
|
if (auto symbolVal = dyn_cast<Value>(callable))
|
|
return symbolVal.getDefiningOp();
|
|
|
|
// If the callable isn't a value, lookup the symbol reference.
|
|
auto symbolRef = cast<SymbolRefAttr>(callable);
|
|
if (symbolTable)
|
|
return symbolTable->lookupNearestSymbolFrom(call.getOperation(), symbolRef);
|
|
return SymbolTable::lookupNearestSymbolFrom(call.getOperation(), symbolRef);
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// CallInterfaces
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Interfaces/CallInterfaces.cpp.inc"
|