• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2017 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // RemoveArrayLengthMethod.h:
7 //   Fold array length expressions, including cases where the "this" node has side effects.
8 //   Example:
9 //     int i = (a = b).length();
10 //     int j = (func()).length();
11 //   becomes:
12 //     (a = b);
13 //     int i = <constant array length>;
14 //     func();
15 //     int j = <constant array length>;
16 //
17 //   Must be run after SplitSequenceOperator, SimplifyLoopConditions and SeparateDeclarations steps
18 //   have been done to expressions containing calls of the array length method.
19 //
20 //   Does nothing to length method calls done on runtime-sized arrays.
21 
22 #ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEARRAYLENGTHMETHOD_H_
23 #define COMPILER_TRANSLATOR_TREEOPS_REMOVEARRAYLENGTHMETHOD_H_
24 
25 #include "common/angleutils.h"
26 
27 namespace sh
28 {
29 
30 class TCompiler;
31 class TIntermBlock;
32 
33 ANGLE_NO_DISCARD bool RemoveArrayLengthMethod(TCompiler *compiler, TIntermBlock *root);
34 
35 }  // namespace sh
36 
37 #endif  // COMPILER_TRANSLATOR_TREEOPS_REMOVEARRAYLENGTHMETHOD_H_
38