From cc13dbdde10752d1e0b27a692c129cd243034438 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Mon, 18 Jun 2018 12:09:56 -0700 Subject: [PATCH] [flang] begin expression representation 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 | 9 ++++++--- flang/lib/evaluate/expression.h | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 flang/lib/evaluate/expression.h diff --git a/flang/documentation/ControlFlowGraph.md b/flang/documentation/ControlFlowGraph.md index 517bccf..f3f695a 100644 --- a/flang/documentation/ControlFlowGraph.md +++ b/flang/documentation/ControlFlowGraph.md @@ -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 index 0000000..a64a97a --- /dev/null +++ b/flang/lib/evaluate/expression.h @@ -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 + +namespace Fortran::evaluate { + +template struct Expression; + +template struct Expression { + static constexpr Classification classification{Classification::Integer}; + static constexpr int kind{KIND}; +}; + +using IntegerExpression = Expression; +using RealExpression = Expression; + +} // namespace Fortran::evaluate +#endif // FORTRAN_EVALUATE_EXPRESSION_H_ -- 2.7.4