Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / lib / Common / Fortran.cpp
blob45a06145116846ae925e47c36839aa3eda6a615a
1 //===-- lib/Common/Fortran.cpp --------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "flang/Common/Fortran.h"
11 namespace Fortran::common {
13 const char *AsFortran(NumericOperator opr) {
14 switch (opr) {
15 SWITCH_COVERS_ALL_CASES
16 case NumericOperator::Power:
17 return "**";
18 case NumericOperator::Multiply:
19 return "*";
20 case NumericOperator::Divide:
21 return "/";
22 case NumericOperator::Add:
23 return "+";
24 case NumericOperator::Subtract:
25 return "-";
29 const char *AsFortran(LogicalOperator opr) {
30 switch (opr) {
31 SWITCH_COVERS_ALL_CASES
32 case LogicalOperator::And:
33 return ".and.";
34 case LogicalOperator::Or:
35 return ".or.";
36 case LogicalOperator::Eqv:
37 return ".eqv.";
38 case LogicalOperator::Neqv:
39 return ".neqv.";
40 case LogicalOperator::Not:
41 return ".not.";
45 const char *AsFortran(RelationalOperator opr) {
46 switch (opr) {
47 SWITCH_COVERS_ALL_CASES
48 case RelationalOperator::LT:
49 return "<";
50 case RelationalOperator::LE:
51 return "<=";
52 case RelationalOperator::EQ:
53 return "==";
54 case RelationalOperator::NE:
55 return "/=";
56 case RelationalOperator::GE:
57 return ">=";
58 case RelationalOperator::GT:
59 return ">";
63 } // namespace Fortran::common