[flang] begin expression representation
authorpeter klausler <pklausler@nvidia.com>
Mon, 18 Jun 2018 19:09:56 +0000 (12:09 -0700)
committerpeter klausler <pklausler@nvidia.com>
Fri, 22 Jun 2018 21:56:16 +0000 (14:56 -0700)
Original-commit: flang-compiler/f18@627c057d5c8392914eb186e8f6dacab40b5a6666
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

flang/documentation/ControlFlowGraph.md
flang/lib/evaluate/expression.h [new file with mode: 0644]

index 517bccf..f3f695a 100644 (file)
@@ -18,9 +18,12 @@ of a subprogram's control flow graph in place.
 A _control flow graph_ is a collection of simple (_i.e.,_ "non-extended")
 basic _blocks_ that comprise straight-line sequences of _actions_ with a
 single entry point and a single exit point, and a collection of
-directed flow _edges_ (or _arcs_) denoting all possible transfers of
-control flow that may take place during execution from the ends of
-any basic blocks to the beginning of a basic block.
+directed flow _edges_ (or _arcs_) denoting all possible transition of
+control flow that may take place during execution from the end of
+one basic block to the beginning of another (or itself).
+
+A block that has multiple distinct successors in the flow of control
+must end with an action that selects its successor.
 
 The sequence of actions that constitutes a basic block may
 include references to user and library procedures.
diff --git a/flang/lib/evaluate/expression.h b/flang/lib/evaluate/expression.h
new file mode 100644 (file)
index 0000000..a64a97a
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (c) 2018, NVIDIA CORPORATION.  All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef FORTRAN_EVALUATE_EXPRESSION_H_
+#define FORTRAN_EVALUATE_EXPRESSION_H_
+
+#include "type.h"
+#include "../common/indirection.h"
+#include <variant>
+
+namespace Fortran::evaluate {
+
+template<Classification C, int KIND> struct Expression;
+
+template<int KIND> struct Expression<Classification::Integer> {
+  static constexpr Classification classification{Classification::Integer};
+  static constexpr int kind{KIND};
+};
+
+using<int KIND> IntegerExpression = Expression<Classification::Integer, KIND>;
+using<int KIND> RealExpression = Expression<Classification::Real, KIND>;
+
+}  // namespace Fortran::evaluate
+#endif  // FORTRAN_EVALUATE_EXPRESSION_H_