This adds enough infrastructure to type determiner to start building
out the statement and expression determination.
Bug: tint:5
Change-Id: I5e095cf652b5e3358e6fbabd66dd703348950857
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18826
Reviewed-by: David Neto <dneto@google.com>
This CL adds helper methods to the RelationalExpression to determine the
type of relation.
Bug: tint:5
Change-Id: I232c3a2e9f27a7efb91735516ee7e9cfc97882ae
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18825
Reviewed-by: David Neto <dneto@google.com>
This CL adds various using statements for the
std::vector<std::unique_ptr<CLASS>> constructs found in the AST.
Change-Id: Ic9a2357cd73b2aafd99e961a38727f2f9874cde5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18920
Reviewed-by: David Neto <dneto@google.com>
This CL adds a result_type into the expression to hold the computed
result type for the expression.
Bug: tint:5
Change-Id: I5f2ee35e520f918828cf8cf7bc6fdf6a1b5ebd5f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18824
Reviewed-by: David Neto <dneto@google.com>
This CL adds the Context object, variable ScopeStack and a Function map
into the type determiner.
The sample app is also updated to verify the module produced before
passing to the type determiner.
Bug: tint:5
Change-Id: Ib4af4e4305ee8a306f48e1bd328eaf3ad006fd9a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18823
Reviewed-by: David Neto <dneto@google.com>
The CONTRIBUTING was written before the decision to use the
dawn-reviews. This CL updates to the correct information.
Bug: tint:36
Change-Id: I7e15572a3ed4bc4bbaaba8972e84eeda111d953f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18921
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
VS2017 took issue with treating size_t and uint32_t the same. It also
couldn't find various alphanumeric is* functions without the <cctype>
header. Gcc complainted about a variable potentially used uninitialized.
Change-Id: I452b68c6597bae254f32e5a350656e65c8934b6e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18901
Reviewed-by: dan sinclair <dsinclair@google.com>
The depot_tools install was mentioned in the building section but was
missing from requirements. This CL fixes that oversight.
Bug: tint:35
Change-Id: I6900ba8916d26dc03bd001bde96561a468a2fb75
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18900
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This Cl extracts the variable stack from the SPIR-V builder and makes it
available as a general class.
Change-Id: I3505d7cc4ec34f78bbc3360b064fa99479fd97d6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18701
Reviewed-by: David Neto <dneto@google.com>
Describe the use of the term "type" in this class.
Change-Id: Iad41c9c49ff2145f278bf7e7a601da0e5492301c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17980
Reviewed-by: dan sinclair <dsinclair@google.com>
Fix typos in SPIR-V IDs that were causing the optimizer to assert
out when building up its internal data structures.
Bug: tint:3
Change-Id: I27210623b0d3d241dbd6afe6bef63e88a02b390e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18640
Reviewed-by: dan sinclair <dsinclair@google.com>
This Cl adds assignment statement generation to the SPIR-V writer.
Bug: tint:5
Change-Id: I17876c0211e4b4e061d39e08fc6a433098252f38
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18621
Reviewed-by: David Neto <dneto@google.com>
This CL removes a std::move which triggers a -Wpessimizing-move error
Change-Id: I378f32a808a86a0944a4bb41f243b7416c10a9fd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18602
Reviewed-by: dan sinclair <dsinclair@google.com>
This Cl adds the code to convert an identifer expression into an ID.
Bug: tint:5
Change-Id: Id6cb08404f091fd4d89c3f7f9292c9de2eb4fa65
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18601
Reviewed-by: David Neto <dneto@google.com>
This Cl adds function variables to the SPIR-V output. This requires some
refactoring to split function instructions and variables apart in the
builder.
Bug: tint:5
Change-Id: I4d0045f5a02311cf9a2803929c66c648278e3734
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18600
Reviewed-by: David Neto <dneto@google.com>
Only emit functions that have bodies.
Don't emit their bodies yet.
Emit them so that callees precede callers.
Bug: tint:3
Change-Id: Ia67ba2fe1d47c7c7d5c290d1d4fc5256fa293b51
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18620
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL fixes the emitting of global constants to use the correct
`OpConstantComposite` call when adding to the types section. A TODO is
added to generate `OpCompositeConstruct` when we need to generate
initializers inside functions.
Bug: tint:5
Change-Id: I1bbf6c68e21b546d6a643b4c99c7d2c9317bfcbd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18440
Reviewed-by: David Neto <dneto@google.com>
The variable was incorrectly set to be a `vec3<f32>` instead of a
`vec3<u32>`.
Bug: tint:24
Change-Id: I84262a185925c50adf3a149f5f93f45124499596
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18400
Reviewed-by: David Neto <dneto@google.com>
This CL renames VariableStatement to VariableDeclStatement to make it
clearer what it was modeling.
Bug: tint:25
Change-Id: Idd0d27fad7cc402f286e1abad74092c9d1961d91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18341
Reviewed-by: David Neto <dneto@google.com>
This Cl updates the names of the initializer expressions to be clearer.
* InitializerExpression -> ConstructorExpression
* ConstInitializerExpression -> ScalarConstructorExpression
* TypeInitializerExpression -> TypeConstructorExpression
Bug: tint:26
Change-Id: Ib046497f589cc65d1d64bc172015588348feeffe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18340
Reviewed-by: David Neto <dneto@google.com>
Handle as many member decorations as the Tint AST can express right now.
See crbug.com/tint/30
Bug: tint:3
Change-Id: I6d04f1beb438b3d952a76886fbd9c6b7ea701d81
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18160
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds the code to generate OpReturn and OpReturnValue statements.
Bug: tint:5
Change-Id: Ia4e4f6eb3f8b182be0caea88147d23fe4b6e341c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18300
Reviewed-by: David Neto <dneto@google.com>
This CL adds generation for the ConstInitializer and TypeInitializer
expression. The global variable method has been extended to output the
constant and variable initializers.
Bug: tint:5
Change-Id: I2b3783d0e5a8bbf7a6aba9cf6e154910568bdb5d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18241
Reviewed-by: David Neto <dneto@google.com>
This CL starts adding global variable output to the SPIR-V writer. This
does not handle constants or initializers at this point.
Bug: tint:5
Change-Id: Id06533b2ec1f61feadf66f3e43a484f6f3765546
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17922
Reviewed-by: David Neto <dneto@google.com>
Bug: tint:3
Change-Id: I9655ddbe48f2660f88be68bc52c9467d805043ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18080
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Add a Context::Reset method to clear state.
Hide the member behind an accessor.
Change-Id: Iafb7c39249f66f70c5a99a8ed1c69f2c0238834f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17742
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds the type generation for OpTypePointer.
Bug: tint:5
Change-Id: I9cfe6c4fbd9173df925421f278abd1afbda50fc9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17840
Reviewed-by: David Neto <dneto@google.com>
This CL adds generation of OpTypeArray and OpTypeRuntimeArray to the
SPIR-V writer.
Bug: tint:5
Change-Id: If3764ddb2499b8a196039521b8d9f80842626bcf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17821
Reviewed-by: David Neto <dneto@google.com>
This CL updates the SPIR-V writer to generate the OpConstantTrue,
OpConstantFalse and OpConstant instructions.
Bug: tint:5
Change-Id: I660554c491e4eb569e3902fce0973fae3f27e6c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17820
Reviewed-by: David Neto <dneto@google.com>
This CL changes the struct generation to emit the `OpName` for the
struct instead of doing it in a separate type alias pass. The struct
name was the only thing that needed to be output in the type alias pass
and this makes sure it's only emitted if used.
Bug: tint:5
Change-Id: I7389a3cd61812171fceeaae99253610152aa523d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17860
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL moves all test files to the anonymous namespace.
Change-Id: Ie5ae0efe907c03eeb441e90f31c976844172b594
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17900
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL fixes up several documentation and linter warnings.
Change-Id: Ic367ba1937f20dfe47a8c8e4035c17e8a3d0f2e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17880
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL updates the SPIR-V writer to emit the OpTypeFunction and
OpFunction instructions.
Bug: tint:5
Change-Id: I85ead161ca37304a977213257a825ff268d29f2d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17741
Reviewed-by: David Neto <dneto@google.com>