src/compiler/translator/RewriteElseBlocks.cpp


Log

Author Commit Date CI Message
Olli Etuaho 8ad9e757 2017-01-16T19:55:20 Always store function headers in TIntermFunctionPrototype nodes TIntermFunctionDefinition nodes now have a TIntermFunctionPrototype child that stores the function signature, instead of having a separate type and an aggregate child that stores the parameters. This makes parsing functions simpler, and paves the way for further simplifications of function parsing, like reducing conversions between symbol table structures and AST structures. TIntermAggregate is now only used for function calls. BUG=angleproject:1490 TEST=angle_unittests, angle_end2end_tests Change-Id: Ib56a77b5ef5123b142963a18499690bf37fed987 Reviewed-on: https://chromium-review.googlesource.com/427945 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill d7b1ab58 2016-12-12T14:42:19 Fix up translator style. Using git cl format. BUG=angleproject:650 Change-Id: I7d3f98d2b0dcfb0a8de6c35327db74e55c28d761 Reviewed-on: https://chromium-review.googlesource.com/419059 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 13389b66 2016-10-16T11:48:18 Split TIntermDeclaration from TIntermAggregate The new class TIntermDeclaration is now used for struct, interface block and variable declarations. TIntermDeclaration nodes do not have a type - rather the type is stored in each child node. The types may differ in case the declaration is a series of array declarators with mismatching sizes. TIntermAggregate is still used for function calls, function prototypes, function parameter lists and invariant declarations. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I0457188f354481470855f61ac1c878fc2579b1d1 Reviewed-on: https://chromium-review.googlesource.com/400023 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 336b1470 2016-10-05T16:37:55 Split TIntermFunctionDefinition from TIntermAggregate This makes the code easier to understand. Function definition nodes always have just two children, the parameters node and the function body node, so there was no proper reason why they should be aggregate nodes. As a part of this change, intermediate output is modified to print symbol table ids of functions so that debugging function id related functionality will be easier in the future. After this patch, TIntermAggregate is still used for function prototypes, function parameter lists, function calls, variable and invariant declarations and the comma (sequence) operator. BUG=angleproject:1490 TEST=angle_unittests, angle_end2end_tests Change-Id: Ib88b4ca5d21abd5f126836ca5900d0baecabd19e Reviewed-on: https://chromium-review.googlesource.com/394707 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 6d40bbdd 2016-09-30T13:49:38 Split TIntermBlock from TIntermAggregate The new TIntermBlock node class replaces TIntermAggregate nodes with the EOpSequence op. It represents the root node of the tree which is a list of declarations and function definitions, and any code blocks that can be denoted by curly braces. These include function and loop bodies, and if-else branches. This change enables a bunch of more compile-time type checking, and makes the AST code easier to understand and less error-prone. The PostProcess step that used to be done to ensure that the root node is TIntermAggregate is removed in favor of making sure that the root node is a TIntermBlock in the glslang.y parsing code. Intermediate output formatting is improved to print the EOpNull error in a clearer way. After this patch, TIntermAggregate is still used for function definitions, function prototypes, function parameter lists, function calls, variable and invariant declarations and the comma (sequence) operator. BUG=angleproject:1490 TEST=angle_unittests, angle_end2end_tests Change-Id: I04044affff979a11577bc1fe75d747e538b799c8 Reviewed-on: https://chromium-review.googlesource.com/393726 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 32db19b7 2016-10-04T14:43:16 Ensure that if-else branches are always sequence nodes This mainly affects RewriteElseBlocks, which was the only piece of code still adding TIntermIfElse nodes directly as children of other TIntermIfElse nodes. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I5b25c2fb9c642424417cd6c29e37c20482c6ffaf Reviewed-on: https://chromium-review.googlesource.com/392847 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 5796127e 2016-09-14T13:57:46 Rename TIntermSelection to TIntermIfElse Now that ternary nodes are not represented by TIntermSelection any more, TIntermIfElse is an easier name to understand for newcomers to the code. BUG=angleproject:1490 TEST=angle_unittests Change-Id: Ia1e04e356ab93409400245092a84533d7dfd129d Reviewed-on: https://chromium-review.googlesource.com/385416 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho a223430c 2016-08-31T12:05:39 Promote unary nodes automatically Unary nodes now get their type set automatically based on the operation and operand. The operand should only be changed to another of the same type after the node is constructed. The operation can't be changed on unary and binary nodes after they've been constructed. BUG=angleproject:1490 TEST=angle_unittests Change-Id: Ib1ea3dcb1162261966c02d5f03d8091cf647fac1 Reviewed-on: https://chromium-review.googlesource.com/378935 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez 2d58f7a2 2015-09-28T10:44:55 RewriteElseBlocks.cpp: add missing override Change-Id: Ic98de554cabffabd3cdd58b2a44a554cb2c3cd53 Reviewed-on: https://chromium-review.googlesource.com/302464 Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Ben Wells e6e8c7c5 2015-07-01T16:48:31 Fix 'unused private field' warnings for clang. BUG=505317 Change-Id: I731b6e5ae5d5eba50f556314eeeebc6a3d29fc7a Reviewed-on: https://chromium-review.googlesource.com/282932 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 64f0be91 2015-06-03T17:38:34 Remove unused right-to-left AST traversal support No code actually uses the right-to-left traversal. All it does is add unnecessary complexity. TEST=angle_unittests, angle_end2end_tests BUG=angleproject:1037 Change-Id: Id15498343538c02c252ef0852f9a00c85ac3c4bb Reviewed-on: https://chromium-review.googlesource.com/275183 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 4d59f3c6 2015-05-28T17:33:53 Make false blocks produced by RewriteElseBlocks sequence nodes All child nodes of selection should be sequence nodes, so that they will output braces and extra braces can be removed from HLSL output. Also make RewriteElseBlocks to reuse common IntermTraverser functionality to simplify the code. TEST=WebGL conformance tests on D3D9 BUG=angleproject:1013 Change-Id: Iafdc05468b22d110abcd020cf52c646dd98fb4a0 Reviewed-on: https://chromium-review.googlesource.com/273608 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 78174db7 2015-04-21T16:14:00 Replace EvqInternal with a separate flag to make it more flexible The internal flag disables decorating a given symbol in output, effectively placing it to a different namespace than user-defined symbols. This enables the compiler to insert symbols to the tree when transforming it to be suitable for HLSL output without running into name conflicts. In this patch the flag is separated from the qualifiers since sometimes different qualifiers need to be used with these internal symbols. TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests BUG=angleproject:941 Change-Id: I7036bed98fdb1478a383bb959ca03b42c3cb8100 Reviewed-on: https://chromium-review.googlesource.com/266690 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 4836d22a 2014-07-24T06:55:51 Fix ASSERT when rewriting else-if blocks with no else. The code assumed an else-if would end in an else. We can also save a few allocations in the cases where there is no else. BUG=angle:699 Change-Id: I550857366775b4a34aea97e117ef732297d3f448 Reviewed-on: https://chromium-review.googlesource.com/208681 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Zhenyao Mo e40d1e9c 2014-07-16T17:40:36 Fix style violations. BUG=angle:650 TEST=no behavior change Change-Id: I3096615a181b1ec2c18ce60566c3d6249975b84e Reviewed-on: https://chromium-review.googlesource.com/208569 Tested-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 787fc03f 2014-07-07T12:49:45 Fix HLSL compiler error with else-rewriting in functions. In functions with return types where we would use if-else rewriting, we would potentially generate a spurious HLSL error that warned of branches with no return value in the function. This was causing a maps regression where overlays would not draw in Earth mode. BUG=346463 BUG=391697 Change-Id: I9f4fa959057a3a2dab6cdd98f8381b5871cabf03 Reviewed-on: https://chromium-review.googlesource.com/206824 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org> Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Jamie Madill ed3eef1f 2014-02-26T09:47:11 Fix not rewriting else-if blocks. We would miss expanding the else-if clauses in a chain of selection statements. BUG=346463 BUG=391697 Change-Id: Iee644b875cf68d0ed3dc0b73542efc49ecb23242 Reviewed-on: https://chromium-review.googlesource.com/206822 Reviewed-by: Nicolas Capens <capn@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Jamie Madill e53c98ba 2014-02-03T11:57:13 Add work-around for D3D9 shader compiler bug. With certain selection statements with a vertex input in the condition and side-effects in the else-block, we'd run in to a D3D9 compiler bug which would cause incorrect results. We can work around this bug in D3D9 by selectively rewriting these statements to use an 'else if' clause instead of 'else'. BUG=322794 Change-Id: I93c96fb201ff4959c00d9a36321faac7e0343278 Reviewed-on: https://chromium-review.googlesource.com/184681 Reviewed-by: Nicolas Capens <nicolascapens@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>