mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-15 03:41:34 +00:00
tint/ir: Replace getter with raw fields for more classes
There's an odd mix of IR classes that use raw fields, and others that have getters. Migrate a bunch of those getters to raw fields. Change-Id: I5c80abe16d3b4e6e5e9dc8f985611f9edfe5cdc6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131621 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
895d240fbf
commit
146b67e0cd
@ -19,8 +19,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ir::Binary);
|
|||||||
|
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
Binary::Binary(uint32_t id, Kind kind, const type::Type* ty, Value* lhs, Value* rhs)
|
Binary::Binary(uint32_t identifier, Kind kind, const type::Type* ty, Value* lhs, Value* rhs)
|
||||||
: Base(id, ty), kind_(kind), lhs_(lhs), rhs_(rhs) {
|
: Base(identifier, ty), kind_(kind), lhs_(lhs), rhs_(rhs) {
|
||||||
TINT_ASSERT(IR, lhs_);
|
TINT_ASSERT(IR, lhs_);
|
||||||
TINT_ASSERT(IR, rhs_);
|
TINT_ASSERT(IR, rhs_);
|
||||||
lhs_->AddUsage(this);
|
lhs_->AddUsage(this);
|
||||||
|
@ -19,8 +19,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ir::Bitcast);
|
|||||||
|
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
Bitcast::Bitcast(uint32_t id, const type::Type* type, Value* val)
|
Bitcast::Bitcast(uint32_t identifier, const type::Type* ty, Value* val)
|
||||||
: Base(id, type, utils::Vector{val}) {}
|
: Base(identifier, ty, utils::Vector{val}) {}
|
||||||
|
|
||||||
Bitcast::~Bitcast() = default;
|
Bitcast::~Bitcast() = default;
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ TEST_F(IR_InstructionTest, Bitcast) {
|
|||||||
ASSERT_TRUE(inst->Is<ir::Bitcast>());
|
ASSERT_TRUE(inst->Is<ir::Bitcast>());
|
||||||
ASSERT_NE(inst->Type(), nullptr);
|
ASSERT_NE(inst->Type(), nullptr);
|
||||||
|
|
||||||
ASSERT_EQ(inst->Args().Length(), 1u);
|
ASSERT_EQ(inst->args.Length(), 1u);
|
||||||
ASSERT_TRUE(inst->Args()[0]->Is<Constant>());
|
ASSERT_TRUE(inst->args[0]->Is<Constant>());
|
||||||
auto val = inst->Args()[0]->As<Constant>()->value;
|
auto val = inst->args[0]->As<Constant>()->value;
|
||||||
ASSERT_TRUE(val->Is<constant::Scalar<i32>>());
|
ASSERT_TRUE(val->Is<constant::Scalar<i32>>());
|
||||||
EXPECT_EQ(4_i, val->As<constant::Scalar<i32>>()->ValueAs<i32>());
|
EXPECT_EQ(4_i, val->As<constant::Scalar<i32>>()->ValueAs<i32>());
|
||||||
}
|
}
|
||||||
@ -42,10 +42,10 @@ TEST_F(IR_InstructionTest, Bitcast_Usage) {
|
|||||||
const auto* inst =
|
const auto* inst =
|
||||||
b.builder.Bitcast(b.builder.ir.types.Get<type::I32>(), b.builder.Constant(4_i));
|
b.builder.Bitcast(b.builder.ir.types.Get<type::I32>(), b.builder.Constant(4_i));
|
||||||
|
|
||||||
ASSERT_EQ(inst->Args().Length(), 1u);
|
ASSERT_EQ(inst->args.Length(), 1u);
|
||||||
ASSERT_NE(inst->Args()[0], nullptr);
|
ASSERT_NE(inst->args[0], nullptr);
|
||||||
ASSERT_EQ(inst->Args()[0]->Usage().Length(), 1u);
|
ASSERT_EQ(inst->args[0]->Usage().Length(), 1u);
|
||||||
EXPECT_EQ(inst->Args()[0]->Usage()[0], inst);
|
EXPECT_EQ(inst->args[0]->Usage()[0], inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "src/tint/ir/builtin.h"
|
#include "src/tint/ir/builtin.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "src/tint/debug.h"
|
#include "src/tint/debug.h"
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::ir::Builtin);
|
TINT_INSTANTIATE_TYPEINFO(tint::ir::Builtin);
|
||||||
@ -20,11 +23,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ir::Builtin);
|
|||||||
// \cond DO_NOT_DOCUMENT
|
// \cond DO_NOT_DOCUMENT
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
Builtin::Builtin(uint32_t id,
|
Builtin::Builtin(uint32_t identifier,
|
||||||
const type::Type* type,
|
const type::Type* ty,
|
||||||
builtin::Function func,
|
builtin::Function func,
|
||||||
utils::VectorRef<Value*> args)
|
utils::VectorRef<Value*> arguments)
|
||||||
: Base(id, type, args), func_(func) {}
|
: Base(identifier, ty, std::move(arguments)), func_(func) {}
|
||||||
|
|
||||||
Builtin::~Builtin() = default;
|
Builtin::~Builtin() = default;
|
||||||
|
|
||||||
|
@ -14,14 +14,14 @@
|
|||||||
|
|
||||||
#include "src/tint/ir/call.h"
|
#include "src/tint/ir/call.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::ir::Call);
|
TINT_INSTANTIATE_TYPEINFO(tint::ir::Call);
|
||||||
|
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
Call::Call() : Base() {}
|
Call::Call(uint32_t identifier, const type::Type* ty, utils::VectorRef<Value*> arguments)
|
||||||
|
: Base(identifier, ty), args(std::move(arguments)) {
|
||||||
Call::Call(uint32_t id, const type::Type* type, utils::VectorRef<Value*> args)
|
|
||||||
: Base(id, type), args_(args) {
|
|
||||||
for (auto* arg : args) {
|
for (auto* arg : args) {
|
||||||
arg->AddUsage(this);
|
arg->AddUsage(this);
|
||||||
}
|
}
|
||||||
|
@ -30,20 +30,17 @@ class Call : public utils::Castable<Call, Instruction> {
|
|||||||
Call& operator=(const Call& inst) = delete;
|
Call& operator=(const Call& inst) = delete;
|
||||||
Call& operator=(Call&& inst) = delete;
|
Call& operator=(Call&& inst) = delete;
|
||||||
|
|
||||||
/// @returns the constructor arguments
|
/// The constructor arguments
|
||||||
utils::VectorRef<Value*> Args() const { return args_; }
|
utils::Vector<Value*, 1> args;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
Call();
|
Call() = delete;
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// @param id the instruction id
|
/// @param id the instruction id
|
||||||
/// @param type the result type
|
/// @param type the result type
|
||||||
/// @param args the constructor arguments
|
/// @param args the constructor arguments
|
||||||
Call(uint32_t id, const type::Type* type, utils::VectorRef<Value*> args);
|
Call(uint32_t id, const type::Type* type, utils::VectorRef<Value*> args);
|
||||||
|
|
||||||
private:
|
|
||||||
utils::Vector<Value*, 1> args_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tint::ir
|
} // namespace tint::ir
|
||||||
|
@ -13,14 +13,17 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "src/tint/ir/construct.h"
|
#include "src/tint/ir/construct.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "src/tint/debug.h"
|
#include "src/tint/debug.h"
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::ir::Construct);
|
TINT_INSTANTIATE_TYPEINFO(tint::ir::Construct);
|
||||||
|
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
Construct::Construct(uint32_t id, const type::Type* type, utils::VectorRef<Value*> args)
|
Construct::Construct(uint32_t identifier, const type::Type* ty, utils::VectorRef<Value*> arguments)
|
||||||
: Base(id, type, args) {}
|
: Base(identifier, ty, std::move(arguments)) {}
|
||||||
|
|
||||||
Construct::~Construct() = default;
|
Construct::~Construct() = default;
|
||||||
|
|
||||||
|
@ -19,11 +19,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ir::Convert);
|
|||||||
|
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
Convert::Convert(uint32_t id,
|
Convert::Convert(uint32_t identifier,
|
||||||
const type::Type* to_type,
|
const type::Type* to_type,
|
||||||
const type::Type* from_type,
|
const type::Type* from_type,
|
||||||
utils::VectorRef<Value*> args)
|
utils::VectorRef<Value*> arguments)
|
||||||
: Base(id, to_type, args), from_type_(from_type) {}
|
: Base(identifier, to_type, arguments), from_type_(from_type) {}
|
||||||
|
|
||||||
Convert::~Convert() = default;
|
Convert::~Convert() = default;
|
||||||
|
|
||||||
|
@ -355,7 +355,11 @@ void Disassembler::EmitValue(const Value* val) {
|
|||||||
emit(constant->value);
|
emit(constant->value);
|
||||||
},
|
},
|
||||||
[&](const ir::Instruction* i) {
|
[&](const ir::Instruction* i) {
|
||||||
out_ << "%" << std::to_string(i->Id());
|
if (i->id == ir::Instruction::kNoID) {
|
||||||
|
out_ << "<no-id>";
|
||||||
|
} else {
|
||||||
|
out_ << "%" << i->id;
|
||||||
|
}
|
||||||
if (i->Type() != nullptr) {
|
if (i->Type() != nullptr) {
|
||||||
out_ << ":" << i->Type()->FriendlyName();
|
out_ << ":" << i->Type()->FriendlyName();
|
||||||
}
|
}
|
||||||
@ -389,27 +393,27 @@ void Disassembler::EmitInstruction(const Instruction* inst) {
|
|||||||
},
|
},
|
||||||
[&](const ir::Store* s) {
|
[&](const ir::Store* s) {
|
||||||
out_ << "store ";
|
out_ << "store ";
|
||||||
EmitValue(s->To());
|
EmitValue(s->to);
|
||||||
out_ << ", ";
|
out_ << ", ";
|
||||||
EmitValue(s->From());
|
EmitValue(s->from);
|
||||||
},
|
},
|
||||||
[&](const ir::UserCall* uc) {
|
[&](const ir::UserCall* uc) {
|
||||||
EmitValue(uc);
|
EmitValue(uc);
|
||||||
out_ << " = call " << uc->Name().Name();
|
out_ << " = call " << uc->name.Name();
|
||||||
if (uc->Args().Length() > 0) {
|
if (uc->args.Length() > 0) {
|
||||||
out_ << ", ";
|
out_ << ", ";
|
||||||
}
|
}
|
||||||
EmitArgs(uc);
|
EmitArgs(uc);
|
||||||
},
|
},
|
||||||
[&](const ir::Var* v) {
|
[&](const ir::Var* v) {
|
||||||
EmitValue(v);
|
EmitValue(v);
|
||||||
out_ << " = var " << v->AddressSpace() << " " << v->Access();
|
out_ << " = var " << v->address_space << " " << v->access;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Disassembler::EmitArgs(const Call* call) {
|
void Disassembler::EmitArgs(const Call* call) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (const auto* arg : call->Args()) {
|
for (const auto* arg : call->args) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
out_ << ", ";
|
out_ << ", ";
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ir::Discard);
|
|||||||
|
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
Discard::Discard() : Base() {}
|
Discard::Discard() : Base(kNoID, nullptr, utils::Empty) {}
|
||||||
|
|
||||||
Discard::~Discard() = default;
|
Discard::~Discard() = default;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ namespace tint::ir {
|
|||||||
|
|
||||||
Instruction::Instruction() = default;
|
Instruction::Instruction() = default;
|
||||||
|
|
||||||
Instruction::Instruction(uint32_t id, const type::Type* ty) : id_(id), type_(ty) {}
|
Instruction::Instruction(uint32_t identifier, const type::Type* ty) : id(identifier), type(ty) {}
|
||||||
|
|
||||||
Instruction::~Instruction() = default;
|
Instruction::~Instruction() = default;
|
||||||
|
|
||||||
|
@ -23,6 +23,9 @@ namespace tint::ir {
|
|||||||
/// An instruction in the IR.
|
/// An instruction in the IR.
|
||||||
class Instruction : public utils::Castable<Instruction, Value> {
|
class Instruction : public utils::Castable<Instruction, Value> {
|
||||||
public:
|
public:
|
||||||
|
/// The identifier used by instructions that have no value.
|
||||||
|
static constexpr uint32_t kNoID = 0;
|
||||||
|
|
||||||
Instruction(const Instruction& inst) = delete;
|
Instruction(const Instruction& inst) = delete;
|
||||||
Instruction(Instruction&& inst) = delete;
|
Instruction(Instruction&& inst) = delete;
|
||||||
/// Destructor
|
/// Destructor
|
||||||
@ -31,10 +34,14 @@ class Instruction : public utils::Castable<Instruction, Value> {
|
|||||||
Instruction& operator=(const Instruction& inst) = delete;
|
Instruction& operator=(const Instruction& inst) = delete;
|
||||||
Instruction& operator=(Instruction&& inst) = delete;
|
Instruction& operator=(Instruction&& inst) = delete;
|
||||||
|
|
||||||
/// @returns the id of the instruction
|
|
||||||
uint32_t Id() const { return id_; }
|
|
||||||
/// @returns the type of the value
|
/// @returns the type of the value
|
||||||
const type::Type* Type() const override { return type_; }
|
const type::Type* Type() const override { return type; }
|
||||||
|
|
||||||
|
/// The instruction identifier
|
||||||
|
const uint32_t id = kNoID;
|
||||||
|
|
||||||
|
/// The instruction type
|
||||||
|
const type::Type* type = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
@ -43,10 +50,6 @@ class Instruction : public utils::Castable<Instruction, Value> {
|
|||||||
/// @param id the instruction id
|
/// @param id the instruction id
|
||||||
/// @param type the result type
|
/// @param type the result type
|
||||||
Instruction(uint32_t id, const type::Type* type);
|
Instruction(uint32_t id, const type::Type* type);
|
||||||
|
|
||||||
private:
|
|
||||||
uint32_t id_ = 0;
|
|
||||||
const type::Type* type_ = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tint::ir
|
} // namespace tint::ir
|
||||||
|
@ -19,11 +19,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ir::Store);
|
|||||||
|
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
Store::Store(Value* to, Value* from) : Base(), to_(to), from_(from) {
|
Store::Store(Value* t, Value* f) : Base(), to(t), from(f) {
|
||||||
TINT_ASSERT(IR, to_);
|
TINT_ASSERT(IR, to);
|
||||||
TINT_ASSERT(IR, from_);
|
TINT_ASSERT(IR, from);
|
||||||
to_->AddUsage(this);
|
to->AddUsage(this);
|
||||||
from_->AddUsage(this);
|
from->AddUsage(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Store::~Store() = default;
|
Store::~Store() = default;
|
||||||
|
@ -34,14 +34,10 @@ class Store : public utils::Castable<Store, Instruction> {
|
|||||||
Store& operator=(const Store& inst) = delete;
|
Store& operator=(const Store& inst) = delete;
|
||||||
Store& operator=(Store&& inst) = delete;
|
Store& operator=(Store&& inst) = delete;
|
||||||
|
|
||||||
/// @returns the value being stored too
|
/// the value being stored to
|
||||||
const Value* To() const { return to_; }
|
Value* to = nullptr;
|
||||||
/// @returns the value being stored
|
/// the value being stored
|
||||||
const Value* From() const { return from_; }
|
Value* from = nullptr;
|
||||||
|
|
||||||
private:
|
|
||||||
Value* to_ = nullptr;
|
|
||||||
Value* from_ = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tint::ir
|
} // namespace tint::ir
|
||||||
|
@ -31,10 +31,10 @@ TEST_F(IR_InstructionTest, CreateStore) {
|
|||||||
const auto* inst = b.builder.Store(to, b.builder.Constant(4_i));
|
const auto* inst = b.builder.Store(to, b.builder.Constant(4_i));
|
||||||
|
|
||||||
ASSERT_TRUE(inst->Is<Store>());
|
ASSERT_TRUE(inst->Is<Store>());
|
||||||
ASSERT_EQ(inst->To(), to);
|
ASSERT_EQ(inst->to, to);
|
||||||
|
|
||||||
ASSERT_TRUE(inst->From()->Is<Constant>());
|
ASSERT_TRUE(inst->from->Is<Constant>());
|
||||||
auto lhs = inst->From()->As<Constant>()->value;
|
auto lhs = inst->from->As<Constant>()->value;
|
||||||
ASSERT_TRUE(lhs->Is<constant::Scalar<i32>>());
|
ASSERT_TRUE(lhs->Is<constant::Scalar<i32>>());
|
||||||
EXPECT_EQ(4_i, lhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
|
EXPECT_EQ(4_i, lhs->As<constant::Scalar<i32>>()->ValueAs<i32>());
|
||||||
}
|
}
|
||||||
@ -45,13 +45,13 @@ TEST_F(IR_InstructionTest, Store_Usage) {
|
|||||||
auto* to = b.builder.Discard();
|
auto* to = b.builder.Discard();
|
||||||
const auto* inst = b.builder.Store(to, b.builder.Constant(4_i));
|
const auto* inst = b.builder.Store(to, b.builder.Constant(4_i));
|
||||||
|
|
||||||
ASSERT_NE(inst->To(), nullptr);
|
ASSERT_NE(inst->to, nullptr);
|
||||||
ASSERT_EQ(inst->To()->Usage().Length(), 1u);
|
ASSERT_EQ(inst->to->Usage().Length(), 1u);
|
||||||
EXPECT_EQ(inst->To()->Usage()[0], inst);
|
EXPECT_EQ(inst->to->Usage()[0], inst);
|
||||||
|
|
||||||
ASSERT_NE(inst->From(), nullptr);
|
ASSERT_NE(inst->from, nullptr);
|
||||||
ASSERT_EQ(inst->From()->Usage().Length(), 1u);
|
ASSERT_EQ(inst->from->Usage().Length(), 1u);
|
||||||
EXPECT_EQ(inst->From()->Usage()[0], inst);
|
EXPECT_EQ(inst->from->Usage()[0], inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -19,8 +19,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ir::Unary);
|
|||||||
|
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
Unary::Unary(uint32_t id, Kind kind, const type::Type* type, Value* val)
|
Unary::Unary(uint32_t identifier, Kind kind, const type::Type* ty, Value* val)
|
||||||
: Base(id, type), kind_(kind), val_(val) {
|
: Base(identifier, ty), kind_(kind), val_(val) {
|
||||||
TINT_ASSERT(IR, val_);
|
TINT_ASSERT(IR, val_);
|
||||||
val_->AddUsage(this);
|
val_->AddUsage(this);
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,20 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "src/tint/ir/user_call.h"
|
#include "src/tint/ir/user_call.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "src/tint/debug.h"
|
#include "src/tint/debug.h"
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::ir::UserCall);
|
TINT_INSTANTIATE_TYPEINFO(tint::ir::UserCall);
|
||||||
|
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
UserCall::UserCall(uint32_t id, const type::Type* type, Symbol name, utils::VectorRef<Value*> args)
|
UserCall::UserCall(uint32_t identifier,
|
||||||
: Base(id, type, args), name_(name) {}
|
const type::Type* ty,
|
||||||
|
Symbol n,
|
||||||
|
utils::VectorRef<Value*> arguments)
|
||||||
|
: Base(identifier, ty, std::move(arguments)), name(n) {}
|
||||||
|
|
||||||
UserCall::~UserCall() = default;
|
UserCall::~UserCall() = default;
|
||||||
|
|
||||||
|
@ -37,11 +37,8 @@ class UserCall : public utils::Castable<UserCall, Call> {
|
|||||||
UserCall& operator=(const UserCall& inst) = delete;
|
UserCall& operator=(const UserCall& inst) = delete;
|
||||||
UserCall& operator=(UserCall&& inst) = delete;
|
UserCall& operator=(UserCall&& inst) = delete;
|
||||||
|
|
||||||
/// @returns the function name
|
/// The function name
|
||||||
Symbol Name() const { return name_; }
|
Symbol name;
|
||||||
|
|
||||||
private:
|
|
||||||
Symbol name_{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tint::ir
|
} // namespace tint::ir
|
||||||
|
@ -19,11 +19,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ir::Var);
|
|||||||
|
|
||||||
namespace tint::ir {
|
namespace tint::ir {
|
||||||
|
|
||||||
Var::Var(uint32_t id,
|
Var::Var(uint32_t identifier,
|
||||||
const type::Type* ty,
|
const type::Type* ty,
|
||||||
builtin::AddressSpace address_space,
|
builtin::AddressSpace addr_space,
|
||||||
builtin::Access access)
|
builtin::Access acc)
|
||||||
: Base(id, ty), address_space_(address_space), access_(access) {}
|
: Base(identifier, ty), address_space(addr_space), access(acc) {}
|
||||||
|
|
||||||
Var::~Var() = default;
|
Var::~Var() = default;
|
||||||
|
|
||||||
|
@ -41,15 +41,11 @@ class Var : public utils::Castable<Var, Instruction> {
|
|||||||
Var& operator=(const Var& inst) = delete;
|
Var& operator=(const Var& inst) = delete;
|
||||||
Var& operator=(Var&& inst) = delete;
|
Var& operator=(Var&& inst) = delete;
|
||||||
|
|
||||||
/// @returns the address space
|
/// The variable address space
|
||||||
builtin::AddressSpace AddressSpace() const { return address_space_; }
|
builtin::AddressSpace address_space = builtin::AddressSpace::kUndefined;
|
||||||
|
|
||||||
/// @returns the access mode
|
/// The variable access mode
|
||||||
builtin::Access Access() const { return access_; }
|
builtin::Access access = builtin::Access::kUndefined;
|
||||||
|
|
||||||
private:
|
|
||||||
builtin::AddressSpace address_space_;
|
|
||||||
builtin::Access access_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tint::ir
|
} // namespace tint::ir
|
||||||
|
@ -423,9 +423,9 @@ class Castable : public BASE {
|
|||||||
using TrueBase = BASE;
|
using TrueBase = BASE;
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// @param args the arguments to forward to the base class.
|
/// @param arguments the arguments to forward to the base class.
|
||||||
template <typename... ARGS>
|
template <typename... ARGS>
|
||||||
inline explicit Castable(ARGS&&... args) : TrueBase(std::forward<ARGS>(args)...) {
|
inline explicit Castable(ARGS&&... arguments) : TrueBase(std::forward<ARGS>(arguments)...) {
|
||||||
this->type_info_ = &TypeInfo::Of<CLASS>();
|
this->type_info_ = &TypeInfo::Of<CLASS>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user