[tint][ir] Rename UserCall::Func() -> Target()
Change-Id: I572603851d468ab2eff1c84a0e9fe104a01fba29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/152403
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/core/ir/disassembler.cc b/src/tint/lang/core/ir/disassembler.cc
index 66ce989..a7682b3 100644
--- a/src/tint/lang/core/ir/disassembler.cc
+++ b/src/tint/lang/core/ir/disassembler.cc
@@ -462,7 +462,7 @@
EmitValueWithType(uc);
out_ << " = ";
EmitInstructionName(uc);
- out_ << " %" << IdOf(uc->Func());
+ out_ << " %" << IdOf(uc->Target());
if (!uc->Args().IsEmpty()) {
out_ << ", ";
}
diff --git a/src/tint/lang/core/ir/transform/demote_to_helper.cc b/src/tint/lang/core/ir/transform/demote_to_helper.cc
index e96acd6..0226e99 100644
--- a/src/tint/lang/core/ir/transform/demote_to_helper.cc
+++ b/src/tint/lang/core/ir/transform/demote_to_helper.cc
@@ -102,7 +102,7 @@
},
[&](UserCall* call) {
// Check if we are calling a function that contains a discard.
- discard = HasDiscard(call->Func());
+ discard = HasDiscard(call->Target());
},
[&](ControlInstruction* ctrl) {
// Recurse into control instructions and check their blocks.
@@ -165,7 +165,7 @@
},
[&](UserCall* call) {
// Recurse into user functions.
- ProcessFunction(call->Func());
+ ProcessFunction(call->Target());
},
[&](Store* store) {
// Conditionalize stores to host-visible address spaces.
diff --git a/src/tint/lang/core/ir/user_call.h b/src/tint/lang/core/ir/user_call.h
index 58a381f..f6155ab 100644
--- a/src/tint/lang/core/ir/user_call.h
+++ b/src/tint/lang/core/ir/user_call.h
@@ -42,8 +42,12 @@
/// @returns the call arguments
tint::Slice<Value*> Args() override { return operands_.Slice().Offset(kArgsOperandOffset); }
- /// @returns the called function name
- Function* Func() { return operands_[kFunctionOperandOffset]->As<ir::Function>(); }
+ /// @returns the called function
+ Function* Target() { return operands_[kFunctionOperandOffset]->As<ir::Function>(); }
+
+ /// Sets called function
+ /// @param target the new target of the call
+ void SetTarget(Function* target) { operands_[kFunctionOperandOffset] = target; }
/// @returns the friendly name for the instruction
std::string FriendlyName() override { return "call"; }
diff --git a/src/tint/lang/spirv/writer/printer/printer.cc b/src/tint/lang/spirv/writer/printer/printer.cc
index bda37dc..d5b2d92 100644
--- a/src/tint/lang/spirv/writer/printer/printer.cc
+++ b/src/tint/lang/spirv/writer/printer/printer.cc
@@ -1777,7 +1777,7 @@
void Printer::EmitUserCall(core::ir::UserCall* call) {
auto id = Value(call);
- OperandList operands = {Type(call->Result()->Type()), id, Value(call->Func())};
+ OperandList operands = {Type(call->Result()->Type()), id, Value(call->Target())};
for (auto* arg : call->Args()) {
operands.push_back(Value(arg));
}
diff --git a/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program.cc b/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program.cc
index 169ca8b..726eb6d 100644
--- a/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program.cc
+++ b/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program.cc
@@ -571,7 +571,7 @@
tint::Switch(
call, //
[&](core::ir::UserCall* c) {
- auto* expr = b.Call(NameFor(c->Func()), std::move(args));
+ auto* expr = b.Call(NameFor(c->Target()), std::move(args));
if (!call->HasResults() || call->Result()->Usages().IsEmpty()) {
Append(b.CallStmt(expr));
return;