mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Store location value into sem::Function.
This CL adds an optional location value to the `sem::Function` which will store the resolved `@location` value. Bug: tint:1633 Change-Id: I95130858d8a1cecae1389be74120da29fec2b448 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101063 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
c8278e5cbd
commit
766a458f53
@@ -40,10 +40,12 @@ utils::VectorRef<const Parameter*> SetOwner(utils::VectorRef<Parameter*> paramet
|
||||
|
||||
Function::Function(const ast::Function* declaration,
|
||||
Type* return_type,
|
||||
std::optional<uint32_t> return_location,
|
||||
utils::VectorRef<Parameter*> parameters)
|
||||
: Base(return_type, SetOwner(std::move(parameters), this), EvaluationStage::kRuntime),
|
||||
declaration_(declaration),
|
||||
workgroup_size_{WorkgroupDimension{1}, WorkgroupDimension{1}, WorkgroupDimension{1}} {}
|
||||
workgroup_size_{WorkgroupDimension{1}, WorkgroupDimension{1}, WorkgroupDimension{1}},
|
||||
return_location_(return_location) {}
|
||||
|
||||
Function::~Function() = default;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#define SRC_TINT_SEM_FUNCTION_H_
|
||||
|
||||
#include <array>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -60,9 +61,11 @@ class Function final : public Castable<Function, CallTarget> {
|
||||
/// Constructor
|
||||
/// @param declaration the ast::Function
|
||||
/// @param return_type the return type of the function
|
||||
/// @param return_location the location value for the return, if provided
|
||||
/// @param parameters the parameters to the function
|
||||
Function(const ast::Function* declaration,
|
||||
Type* return_type,
|
||||
std::optional<uint32_t> return_location,
|
||||
utils::VectorRef<Parameter*> parameters);
|
||||
|
||||
/// Destructor
|
||||
@@ -254,6 +257,9 @@ class Function final : public Castable<Function, CallTarget> {
|
||||
/// @return the behaviors of this function
|
||||
sem::Behaviors& Behaviors() { return behaviors_; }
|
||||
|
||||
/// @return the location for the return, if provided
|
||||
std::optional<uint32_t> ReturnLocation() const { return return_location_; }
|
||||
|
||||
private:
|
||||
Function(const Function&) = delete;
|
||||
Function(Function&&) = delete;
|
||||
@@ -274,6 +280,8 @@ class Function final : public Castable<Function, CallTarget> {
|
||||
std::vector<const Function*> ancestor_entry_points_;
|
||||
bool has_discard_ = false;
|
||||
sem::Behaviors behaviors_{sem::Behavior::kNext};
|
||||
|
||||
std::optional<uint32_t> return_location_;
|
||||
};
|
||||
|
||||
} // namespace tint::sem
|
||||
|
||||
Reference in New Issue
Block a user