From e6fda61ef0c4ec0dc63f3f5a5ba43684aacce34a Mon Sep 17 00:00:00 2001 From: David Neto Date: Fri, 23 Oct 2020 17:45:50 +0000 Subject: [PATCH] ast::Variable dumping now indicates is_const If is_const is true, then dump VariableConst{... For ast::DecoratedVariable, dump "DecoratedVariableConst{..." when it's const. Change-Id: I8383e5bc989e4ee20e3a5812f346d5f9a7990dbb Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30920 Commit-Queue: dan sinclair Reviewed-by: dan sinclair --- src/ast/decorated_variable.cc | 6 +- src/ast/variable.cc | 6 +- src/reader/spirv/function_arithmetic_test.cc | 40 ++++++------ src/reader/spirv/function_bit_test.cc | 18 +++--- src/reader/spirv/function_call_test.cc | 6 +- src/reader/spirv/function_composite_test.cc | 42 ++++++------ src/reader/spirv/function_conversion_test.cc | 36 +++++------ .../spirv/function_glsl_std_450_test.cc | 20 +++--- src/reader/spirv/function_logical_test.cc | 52 +++++++-------- src/reader/spirv/function_memory_test.cc | 10 +-- src/reader/spirv/function_misc_test.cc | 20 +++--- src/reader/spirv/function_var_test.cc | 64 +++++++++---------- .../spirv/parser_impl_function_decl_test.cc | 4 +- 13 files changed, 166 insertions(+), 158 deletions(-) diff --git a/src/ast/decorated_variable.cc b/src/ast/decorated_variable.cc index d9e513031d..2b16b994b4 100644 --- a/src/ast/decorated_variable.cc +++ b/src/ast/decorated_variable.cc @@ -77,7 +77,11 @@ bool DecoratedVariable::IsValid() const { void DecoratedVariable::to_str(std::ostream& out, size_t indent) const { make_indent(out, indent); - out << "DecoratedVariable{" << std::endl; + out << "DecoratedVariable"; + if (is_const()) { + out << "Const"; + } + out << "{" << std::endl; make_indent(out, indent + 2); out << "Decorations{" << std::endl; diff --git a/src/ast/variable.cc b/src/ast/variable.cc index 67447a5954..408b6f4f31 100644 --- a/src/ast/variable.cc +++ b/src/ast/variable.cc @@ -87,7 +87,11 @@ void Variable::constructor_to_str(std::ostream& out, size_t indent) const { void Variable::to_str(std::ostream& out, size_t indent) const { make_indent(out, indent); - out << "Variable{" << std::endl; + out << "Variable"; + if (is_const()) { + out << "Const"; + } + out << "{" << std::endl; info_to_str(out, indent + 2); constructor_to_str(out, indent + 2); make_indent(out, indent); diff --git a/src/reader/spirv/function_arithmetic_test.cc b/src/reader/spirv/function_arithmetic_test.cc index 94632c2d4a..bd86258cef 100644 --- a/src/reader/spirv/function_arithmetic_test.cc +++ b/src/reader/spirv/function_arithmetic_test.cc @@ -136,7 +136,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Int) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __i32 @@ -163,7 +163,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __i32 @@ -192,7 +192,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __u32 @@ -221,7 +221,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __u32 @@ -252,7 +252,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__i32 @@ -283,7 +283,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__i32 @@ -316,7 +316,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__u32 @@ -349,7 +349,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__u32 @@ -384,7 +384,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __f32 @@ -411,7 +411,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__f32 @@ -467,7 +467,7 @@ TEST_P(SpvBinaryArithTest, EmitExpression) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); std::ostringstream ss; - ss << R"(Variable{ + ss << R"(VariableConst{ x_1 none )" @@ -691,7 +691,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Scalar_UnsignedResult) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __u32 @@ -726,7 +726,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Vector_UnsignedResult) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__u32 @@ -835,7 +835,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Scalar_UnsignedResult) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __u32 @@ -870,7 +870,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Vector_UnsignedResult) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__u32 @@ -922,7 +922,7 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesScalar) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 none __vec_2__f32 @@ -951,7 +951,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesScalar) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 none __mat_2_2__f32 @@ -980,7 +980,7 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesMatrix) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 none __mat_2_2__f32 @@ -1009,7 +1009,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesVector) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 none __mat_2_2__f32 @@ -1038,7 +1038,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesMatrix) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 none __mat_2_2__f32 diff --git a/src/reader/spirv/function_bit_test.cc b/src/reader/spirv/function_bit_test.cc index a68362b553..636732f50b 100644 --- a/src/reader/spirv/function_bit_test.cc +++ b/src/reader/spirv/function_bit_test.cc @@ -156,7 +156,7 @@ TEST_P(SpvBinaryBitTest, EmitExpression) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); std::ostringstream ss; - ss << R"(Variable{ + ss << R"(VariableConst{ x_1 none )" @@ -389,7 +389,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Int) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __i32 @@ -416,7 +416,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Uint) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __i32 @@ -445,7 +445,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Int) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __u32 @@ -474,7 +474,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Uint) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __u32 @@ -501,7 +501,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__i32 @@ -532,7 +532,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__i32 @@ -565,7 +565,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__u32 @@ -597,7 +597,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__u32 diff --git a/src/reader/spirv/function_call_test.cc b/src/reader/spirv/function_call_test.cc index c3581a5994..4eb8288533 100644 --- a/src/reader/spirv/function_call_test.cc +++ b/src/reader/spirv/function_call_test.cc @@ -92,7 +92,7 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParams) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __u32 @@ -155,7 +155,7 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParamsUsedTwice) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __u32 @@ -245,7 +245,7 @@ TEST_F(SpvParserTest, EmitStatement_CallWithParams) { () { VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __u32 diff --git a/src/reader/spirv/function_composite_test.cc b/src/reader/spirv/function_composite_test.cc index 3264693c97..72b59bf2ea 100644 --- a/src/reader/spirv/function_composite_test.cc +++ b/src/reader/spirv/function_composite_test.cc @@ -87,7 +87,7 @@ TEST_F(SpvParserTest_Composite_Construct, Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __vec_2__u32 @@ -101,7 +101,7 @@ TEST_F(SpvParserTest_Composite_Construct, Vector) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __vec_2__i32 @@ -115,7 +115,7 @@ VariableDeclStatement{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_3 none __vec_2__f32 @@ -143,7 +143,7 @@ TEST_F(SpvParserTest_Composite_Construct, Matrix) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __mat_2_3__f32 @@ -184,7 +184,7 @@ TEST_F(SpvParserTest_Composite_Construct, Array) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __array__u32_5 @@ -215,7 +215,7 @@ TEST_F(SpvParserTest_Composite_Construct, Struct) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __struct_S @@ -250,7 +250,7 @@ TEST_F(SpvParserTest_CompositeExtract, Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __f32 @@ -301,7 +301,7 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_2 none __vec_2__f32 @@ -352,7 +352,7 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_2 none __f32 @@ -386,7 +386,7 @@ TEST_F(SpvParserTest_CompositeExtract, Array) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_2 none __u32 @@ -437,7 +437,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_2 none __i32 @@ -479,7 +479,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_DifferOnlyInMemberName) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_2 none __u32 @@ -492,7 +492,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_DifferOnlyInMemberName) { })")) << ToString(fe.ast_body()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_4 none __u32 @@ -545,7 +545,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_Array_Matrix_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_2 none __f32 @@ -584,7 +584,7 @@ TEST_F(SpvParserTest_CopyObject, Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __u32 @@ -594,7 +594,7 @@ TEST_F(SpvParserTest_CopyObject, Scalar) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -622,7 +622,7 @@ TEST_F(SpvParserTest_CopyObject, Pointer) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __ptr_function__u32 @@ -632,7 +632,7 @@ TEST_F(SpvParserTest_CopyObject, Pointer) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __ptr_function__u32 @@ -661,7 +661,7 @@ TEST_F(SpvParserTest_VectorShuffle, FunctionScopeOperands_UseBoth) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 none __vec_4__u32 @@ -703,7 +703,7 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_UseBoth) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 none __vec_4__u32 @@ -762,7 +762,7 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_AllOnesMapToNull) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 none __vec_2__u32 diff --git a/src/reader/spirv/function_conversion_test.cc b/src/reader/spirv/function_conversion_test.cc index 24a6a7a869..11da1cdced 100644 --- a/src/reader/spirv/function_conversion_test.cc +++ b/src/reader/spirv/function_conversion_test.cc @@ -83,7 +83,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __u32 @@ -109,7 +109,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__f32 @@ -238,7 +238,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromSigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __f32 @@ -265,7 +265,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromUnsigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __f32 @@ -294,7 +294,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromSigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __vec_2__f32 @@ -321,7 +321,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromUnsigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __vec_2__f32 @@ -383,7 +383,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromSigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __f32 @@ -412,7 +412,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromUnsigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __f32 @@ -439,7 +439,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromSigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __vec_2__f32 @@ -468,7 +468,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromUnsigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __vec_2__f32 @@ -529,7 +529,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToSigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __i32 @@ -556,7 +556,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToUnsigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __u32 @@ -585,7 +585,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToSigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __vec_2__i32 @@ -612,7 +612,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToUnsigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __vec_2__u32 @@ -675,7 +675,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToSigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __i32 @@ -704,7 +704,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToUnsigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __u32 @@ -731,7 +731,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToSigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __vec_2__i32 @@ -760,7 +760,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToUnsigned) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); - EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Variable{ + EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 none __vec_2__u32 diff --git a/src/reader/spirv/function_glsl_std_450_test.cc b/src/reader/spirv/function_glsl_std_450_test.cc index 0f38e75928..11c2cb6ef4 100644 --- a/src/reader/spirv/function_glsl_std_450_test.cc +++ b/src/reader/spirv/function_glsl_std_450_test.cc @@ -101,7 +101,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_Floating, Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __f32 @@ -131,7 +131,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_Floating, Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __f32 @@ -165,7 +165,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __f32 @@ -196,7 +196,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __f32 @@ -235,7 +235,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __f32 @@ -265,7 +265,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__f32 @@ -299,7 +299,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __f32 @@ -330,7 +330,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__f32 @@ -369,7 +369,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __f32 @@ -402,7 +402,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__f32 diff --git a/src/reader/spirv/function_logical_test.cc b/src/reader/spirv/function_logical_test.cc index 6e1c336d01..cb7572e1e8 100644 --- a/src/reader/spirv/function_logical_test.cc +++ b/src/reader/spirv/function_logical_test.cc @@ -207,7 +207,7 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -234,7 +234,7 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __vec_2__bool @@ -289,7 +289,7 @@ TEST_P(SpvBinaryLogicalTest, EmitExpression) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); std::ostringstream ss; - ss << R"(Variable{ + ss << R"(VariableConst{ x_1 none )" @@ -697,7 +697,7 @@ TEST_F(SpvFUnordTest, FUnordEqual_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -728,7 +728,7 @@ TEST_F(SpvFUnordTest, FUnordEqual_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -767,7 +767,7 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -798,7 +798,7 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -837,7 +837,7 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -868,7 +868,7 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -907,7 +907,7 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -938,7 +938,7 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -977,7 +977,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -1008,7 +1008,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -1047,7 +1047,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -1078,7 +1078,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_1 none __bool @@ -1117,7 +1117,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_BoolParams) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __bool @@ -1148,7 +1148,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_IntScalarParams) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __u32 @@ -1179,7 +1179,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_FloatScalarParams) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __f32 @@ -1210,7 +1210,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_VectorParams) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __vec_2__u32 @@ -1249,7 +1249,7 @@ TEST_F(SpvFUnordTest, Select_VecBoolCond_VectorParams) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __vec_2__u32 @@ -1294,7 +1294,7 @@ TEST_F(SpvLogicalTest, Any) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __bool @@ -1327,7 +1327,7 @@ TEST_F(SpvLogicalTest, All) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __bool @@ -1360,7 +1360,7 @@ TEST_F(SpvLogicalTest, IsNan_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __bool @@ -1389,7 +1389,7 @@ TEST_F(SpvLogicalTest, IsNan_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __vec_2__bool @@ -1422,7 +1422,7 @@ TEST_F(SpvLogicalTest, IsInf_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __bool @@ -1451,7 +1451,7 @@ TEST_F(SpvLogicalTest, IsInf_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __vec_2__bool diff --git a/src/reader/spirv/function_memory_test.cc b/src/reader/spirv/function_memory_test.cc index 58481924ca..984ee84d2b 100644 --- a/src/reader/spirv/function_memory_test.cc +++ b/src/reader/spirv/function_memory_test.cc @@ -168,7 +168,7 @@ TEST_F(SpvParserTest, EmitStatement_LoadBool) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( - Variable{ + VariableConst{ x_2 none __bool @@ -197,7 +197,7 @@ TEST_F(SpvParserTest, EmitStatement_LoadScalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -207,7 +207,7 @@ TEST_F(SpvParserTest, EmitStatement_LoadScalar) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_3 none __u32 @@ -238,7 +238,7 @@ TEST_F(SpvParserTest, EmitStatement_UseLoadedScalarTwice) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -905,7 +905,7 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithoutHoisting) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __ptr_storage_buffer__u32 diff --git a/src/reader/spirv/function_misc_test.cc b/src/reader/spirv/function_misc_test.cc index 67ce600391..9d87310751 100644 --- a/src/reader/spirv/function_misc_test.cc +++ b/src/reader/spirv/function_misc_test.cc @@ -68,7 +68,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Scalar) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_11 none __bool @@ -78,7 +78,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Scalar) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_12 none __u32 @@ -88,7 +88,7 @@ VariableDeclStatement{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_13 none __i32 @@ -98,7 +98,7 @@ VariableDeclStatement{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_14 none __f32 @@ -128,7 +128,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Vector) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_11 none __vec_2__u32 @@ -142,7 +142,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Vector) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_12 none __vec_2__i32 @@ -156,7 +156,7 @@ VariableDeclStatement{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_13 none __vec_2__f32 @@ -188,7 +188,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Matrix) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_11 none __mat_2_2__f32 @@ -229,7 +229,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_11 none __array__u32_2 @@ -261,7 +261,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) { FunctionEmitter fe(p, *spirv_function(100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_11 none __struct_S diff --git a/src/reader/spirv/function_var_test.cc b/src/reader/spirv/function_var_test.cc index 95791d27d1..f7a164daba 100644 --- a/src/reader/spirv/function_var_test.cc +++ b/src/reader/spirv/function_var_test.cc @@ -695,7 +695,7 @@ TEST_F(SpvParserTest, EmitStatement_CombinatorialValue_Immediate_UsedTwice) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -765,7 +765,7 @@ TEST_F(SpvParserTest, } } VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -971,7 +971,7 @@ TEST_F( // We don't hoist x_1 into its own mutable variable. It is emitted as // a const definition. EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __u32 @@ -988,7 +988,7 @@ If{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_3 none __u32 @@ -1059,7 +1059,7 @@ TEST_F(SpvParserTest, ) { VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __u32 @@ -1076,7 +1076,7 @@ TEST_F(SpvParserTest, } } VariableDeclStatement{ - Variable{ + VariableConst{ x_3 none __u32 @@ -1144,7 +1144,7 @@ TEST_F( ) { VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __u32 @@ -1163,7 +1163,7 @@ TEST_F( } } VariableDeclStatement{ - Variable{ + VariableConst{ x_3 none __u32 @@ -1220,7 +1220,7 @@ TEST_F(SpvParserTest, // We don't hoist x_1 into its own mutable variable. It is emitted as // a const definition. EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_1 none __u32 @@ -1230,7 +1230,7 @@ TEST_F(SpvParserTest, } } VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -1307,7 +1307,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_101 none __bool @@ -1317,7 +1317,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_102 none __bool @@ -1344,7 +1344,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) { } Loop{ VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -1354,7 +1354,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_3 none __u32 @@ -1449,7 +1449,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_101 none __bool @@ -1459,7 +1459,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_102 none __bool @@ -1493,7 +1493,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -1503,7 +1503,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_3 none __u32 @@ -1590,7 +1590,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_ValueFromLoopBodyAndContinuing) { EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_101 none __bool @@ -1631,7 +1631,7 @@ Loop{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -1641,7 +1641,7 @@ Loop{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_5 none __u32 @@ -1651,7 +1651,7 @@ Loop{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_4 none __u32 @@ -1665,7 +1665,7 @@ Loop{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_6 none __u32 @@ -1758,7 +1758,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_FromElseAndThen) { EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_101 none __bool @@ -1768,7 +1768,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_FromElseAndThen) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_102 none __bool @@ -1815,7 +1815,7 @@ Loop{ } continuing { VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -1878,7 +1878,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_FromHeaderAndThen) { EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ - Variable{ + VariableConst{ x_101 none __bool @@ -1888,7 +1888,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_FromHeaderAndThen) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_102 none __bool @@ -1930,7 +1930,7 @@ Loop{ } continuing { VariableDeclStatement{ - Variable{ + VariableConst{ x_2 none __u32 @@ -1991,7 +1991,7 @@ TEST_F(SpvParserTest, EmitStatement_UseInPhiCountsAsUse) { } } VariableDeclStatement{ - Variable{ + VariableConst{ x_11 none __bool @@ -2005,7 +2005,7 @@ VariableDeclStatement{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_12 none __bool @@ -2033,7 +2033,7 @@ If{ } } VariableDeclStatement{ - Variable{ + VariableConst{ x_101 none __bool diff --git a/src/reader/spirv/parser_impl_function_decl_test.cc b/src/reader/spirv/parser_impl_function_decl_test.cc index e840830edc..37af744377 100644 --- a/src/reader/spirv/parser_impl_function_decl_test.cc +++ b/src/reader/spirv/parser_impl_function_decl_test.cc @@ -208,7 +208,7 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) { () { VariableDeclStatement{ - Variable{ + VariableConst{ leaf_result none __u32 @@ -231,7 +231,7 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) { () { VariableDeclStatement{ - Variable{ + VariableConst{ branch_result none __u32