sem: Track function callsites in sem::Function

This will soon be used by a new MSL sanitizing transform.

Change-Id: I254c0d26a843cf6153dc8d146389d09b615e8d89
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51961
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
This commit is contained in:
James Price
2021-05-22 12:48:24 +00:00
committed by Tint LUCI CQ
parent 28ec968b4f
commit bcefe46f44
4 changed files with 15 additions and 2 deletions

View File

@@ -46,6 +46,7 @@ Function::Function(ast::Function* declaration,
std::vector<const Variable*> referenced_module_vars,
std::vector<const Variable*> local_referenced_module_vars,
std::vector<const ast::ReturnStatement*> return_statements,
std::vector<const ast::CallExpression*> callsites,
std::vector<Symbol> ancestor_entry_points,
std::array<WorkgroupDimension, 3> workgroup_size)
: Base(return_type, GetParameters(parameters)),
@@ -54,6 +55,7 @@ Function::Function(ast::Function* declaration,
referenced_module_vars_(std::move(referenced_module_vars)),
local_referenced_module_vars_(std::move(local_referenced_module_vars)),
return_statements_(std::move(return_statements)),
callsites_(callsites),
ancestor_entry_points_(std::move(ancestor_entry_points)),
workgroup_size_(std::move(workgroup_size)) {}

View File

@@ -28,6 +28,7 @@ namespace tint {
namespace ast {
class BindingDecoration;
class BuiltinDecoration;
class CallExpression;
class Function;
class GroupDecoration;
class LocationDecoration;
@@ -62,7 +63,7 @@ class Function : public Castable<Function, CallTarget> {
/// @param referenced_module_vars the referenced module variables
/// @param local_referenced_module_vars the locally referenced module
/// @param return_statements the function return statements
/// variables
/// @param callsites the callsites of the function
/// @param ancestor_entry_points the ancestor entry points
/// @param workgroup_size the workgroup size
Function(ast::Function* declaration,
@@ -71,6 +72,7 @@ class Function : public Castable<Function, CallTarget> {
std::vector<const Variable*> referenced_module_vars,
std::vector<const Variable*> local_referenced_module_vars,
std::vector<const ast::ReturnStatement*> return_statements,
std::vector<const ast::CallExpression*> callsites,
std::vector<Symbol> ancestor_entry_points,
std::array<WorkgroupDimension, 3> workgroup_size);
@@ -97,6 +99,10 @@ class Function : public Castable<Function, CallTarget> {
const std::vector<const ast::ReturnStatement*> ReturnStatements() const {
return return_statements_;
}
/// @returns the list of callsites of this function
std::vector<const ast::CallExpression*> CallSites() const {
return callsites_;
}
/// @returns the ancestor entry points
const std::vector<Symbol>& AncestorEntryPoints() const {
return ancestor_entry_points_;
@@ -176,6 +182,7 @@ class Function : public Castable<Function, CallTarget> {
std::vector<const Variable*> const referenced_module_vars_;
std::vector<const Variable*> const local_referenced_module_vars_;
std::vector<const ast::ReturnStatement*> const return_statements_;
std::vector<const ast::CallExpression*> const callsites_;
std::vector<Symbol> const ancestor_entry_points_;
std::array<WorkgroupDimension, 3> workgroup_size_;
};