#include "src/tint/lang/hlsl/writer/ast_raise/decompose_memory_access.h"
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "src/tint/lang/core/fluent_types.h"
#include "src/tint/lang/core/type/array.h"
#include "src/tint/lang/core/type/atomic.h"
#include "src/tint/lang/core/type/reference.h"
#include "src/tint/lang/core/unary_op.h"
#include "src/tint/lang/wgsl/ast/assignment_statement.h"
#include "src/tint/lang/wgsl/ast/call_statement.h"
#include "src/tint/lang/wgsl/ast/disable_validation_attribute.h"
#include "src/tint/lang/wgsl/program/clone_context.h"
#include "src/tint/lang/wgsl/program/program_builder.h"
#include "src/tint/lang/wgsl/resolver/resolve.h"
#include "src/tint/lang/wgsl/sem/call.h"
#include "src/tint/lang/wgsl/sem/member_accessor_expression.h"
#include "src/tint/lang/wgsl/sem/statement.h"
#include "src/tint/lang/wgsl/sem/struct.h"
#include "src/tint/lang/wgsl/sem/variable.h"
#include "src/tint/utils/containers/map.h"
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/memory/block_allocator.h"
#include "src/tint/utils/rtti/switch.h"
#include "src/tint/utils/text/string_stream.h"
usingnamespacetint::core::number_suffixes;
usingnamespacetint::core::fluent_types;
TINT_INSTANTIATE_TYPEINFO(…);
TINT_INSTANTIATE_TYPEINFO(…);
namespace tint::hlsl::writer {
namespace {
bool ShouldRun(const Program& program) { … }
struct Offset : Castable<Offset> { … };
struct OffsetExpr : Offset { … };
struct OffsetLiteral final : Castable<OffsetLiteral, Offset> { … };
struct OffsetBinOp : Offset { … };
struct LoadStoreKey { … };
struct AtomicKey { … };
bool IntrinsicDataTypeFor(const core::type::Type* ty,
DecomposeMemoryAccess::Intrinsic::DataType& out) { … }
DecomposeMemoryAccess::Intrinsic* IntrinsicLoadFor(ast::Builder* builder,
const core::type::Type* ty,
core::AddressSpace address_space,
const Symbol& buffer) { … }
DecomposeMemoryAccess::Intrinsic* IntrinsicStoreFor(ast::Builder* builder,
const core::type::Type* ty,
const Symbol& buffer) { … }
DecomposeMemoryAccess::Intrinsic* IntrinsicAtomicFor(ast::Builder* builder,
wgsl::BuiltinFn ity,
const core::type::Type* ty,
const Symbol& buffer) { … }
struct BufferAccess { … };
struct Store { … };
}
struct DecomposeMemoryAccess::State { … };
DecomposeMemoryAccess::Intrinsic::Intrinsic(GenerationID pid,
ast::NodeID nid,
Op o,
DataType ty,
core::AddressSpace as,
const ast::IdentifierExpression* buf)
: … { … }
DecomposeMemoryAccess::Intrinsic::~Intrinsic() = default;
std::string DecomposeMemoryAccess::Intrinsic::InternalName() const { … }
const DecomposeMemoryAccess::Intrinsic* DecomposeMemoryAccess::Intrinsic::Clone(
ast::CloneContext& ctx) const { … }
bool DecomposeMemoryAccess::Intrinsic::IsAtomic() const { … }
const ast::IdentifierExpression* DecomposeMemoryAccess::Intrinsic::Buffer() const { … }
DecomposeMemoryAccess::DecomposeMemoryAccess() = default;
DecomposeMemoryAccess::~DecomposeMemoryAccess() = default;
ast::transform::Transform::ApplyResult DecomposeMemoryAccess::Apply(
const Program& src,
const ast::transform::DataMap&,
ast::transform::DataMap&) const { … }
}
TINT_INSTANTIATE_TYPEINFO(…);
TINT_INSTANTIATE_TYPEINFO(…);