summaryrefslogtreecommitdiffstats
path: root/mlir/include
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2020-01-13 15:46:40 -0800
committerRiver Riddle <riverriddle@google.com>2020-01-13 15:51:28 -0800
commitc7748404920b3674e79059cbbe73b6041a214444 (patch)
treee7dc6a063e4f67e6b7b79f6d2fc71b067a315fa2 /mlir/include
parent6fca03f0cae77c275870c4569bfeeb7ca0f561a6 (diff)
downloadbcm5719-llvm-c7748404920b3674e79059cbbe73b6041a214444.tar.gz
bcm5719-llvm-c7748404920b3674e79059cbbe73b6041a214444.zip
[mlir] Update the CallGraph for nested symbol references, and simplify CallableOpInterface
Summary: This enables tracking calls that cross symbol table boundaries. It also simplifies some of the implementation details of CallableOpInterface, i.e. there can only be one region within the callable operation. Depends On D72042 Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D72043
Diffstat (limited to 'mlir/include')
-rw-r--r--mlir/include/mlir/Analysis/CallInterfaces.td22
-rw-r--r--mlir/include/mlir/IR/Function.h25
2 files changed, 14 insertions, 33 deletions
diff --git a/mlir/include/mlir/Analysis/CallInterfaces.td b/mlir/include/mlir/Analysis/CallInterfaces.td
index 3e5b599baf8..bde5a2fc276 100644
--- a/mlir/include/mlir/Analysis/CallInterfaces.td
+++ b/mlir/include/mlir/Analysis/CallInterfaces.td
@@ -54,29 +54,23 @@ def CallableOpInterface : OpInterface<"CallableOpInterface"> {
be a target for a call-like operation (those providing the CallOpInterface
above). These operations may be traditional functional operation
`func @foo(...)`, as well as function producing operations
- `%foo = dialect.create_function(...)`. These operations may produce multiple
- callable regions, or subroutines.
+ `%foo = dialect.create_function(...)`. These operations may only contain a
+ single region, or subroutine.
}];
let methods = [
InterfaceMethod<[{
- Returns a region on the current operation that the given callable refers
- to. This may return null in the case of an external callable object,
- e.g. an external function.
+ Returns the region on the current operation that is callable. This may
+ return null in the case of an external callable object, e.g. an external
+ function.
}],
- "Region *", "getCallableRegion", (ins "CallInterfaceCallable":$callable)
+ "Region *", "getCallableRegion"
>,
InterfaceMethod<[{
- Returns all of the callable regions of this operation.
- }],
- "void", "getCallableRegions",
- (ins "SmallVectorImpl<Region *> &":$callables)
- >,
- InterfaceMethod<[{
- Returns the results types that the given callable region produces when
+ Returns the results types that the callable region produces when
executed.
}],
- "ArrayRef<Type>", "getCallableResults", (ins "Region *":$callable)
+ "ArrayRef<Type>", "getCallableResults"
>,
];
}
diff --git a/mlir/include/mlir/IR/Function.h b/mlir/include/mlir/IR/Function.h
index 3f788bbeeba..5323b352a89 100644
--- a/mlir/include/mlir/IR/Function.h
+++ b/mlir/include/mlir/IR/Function.h
@@ -122,26 +122,13 @@ public:
// CallableOpInterface
//===--------------------------------------------------------------------===//
- /// Returns a region on the current operation that the given callable refers
- /// to. This may return null in the case of an external callable object, e.g.
- /// an external function.
- Region *getCallableRegion(CallInterfaceCallable callable) {
- assert(callable.get<SymbolRefAttr>().getLeafReference() == getName());
- return isExternal() ? nullptr : &getBody();
- }
-
- /// Returns all of the callable regions of this operation.
- void getCallableRegions(SmallVectorImpl<Region *> &callables) {
- if (!isExternal())
- callables.push_back(&getBody());
- }
+ /// Returns the region on the current operation that is callable. This may
+ /// return null in the case of an external callable object, e.g. an external
+ /// function.
+ Region *getCallableRegion() { return isExternal() ? nullptr : &getBody(); }
- /// Returns the results types that the given callable region produces when
- /// executed.
- ArrayRef<Type> getCallableResults(Region *region) {
- assert(!isExternal() && region == &getBody() && "invalid callable");
- return getType().getResults();
- }
+ /// Returns the results types that the callable region produces when executed.
+ ArrayRef<Type> getCallableResults() { return getType().getResults(); }
private:
// This trait needs access to the hooks defined below.
OpenPOWER on IntegriCloud