#include "stmt.h"
-namespace Fortran::IntermediateRepresentation {
+namespace Fortran::FIR {
static std::string dump(const Expression *expression) {
if (expression) {
}
std::string Evaluation::dump() const {
- return std::visit(common::visitors{
- [](Expression *expression) {
- return IntermediateRepresentation::dump(expression);
- },
- [](Variable *variable) {
- return IntermediateRepresentation::dump(variable);
- },
- [](PathVariable *pathVariable) {
- return IntermediateRepresentation::dump(pathVariable);
- },
- [](const semantics::Symbol *symbol) {
- return symbol->name().ToString();
- },
- },
+ return std::visit(
+ common::visitors{
+ [](Expression *expression) { return FIR::dump(expression); },
+ [](Variable *variable) { return FIR::dump(variable); },
+ [](PathVariable *pathVariable) { return FIR::dump(pathVariable); },
+ [](const semantics::Symbol *symbol) {
+ return symbol->name().ToString();
+ },
+ },
u);
}
[](const ReturnStmt &) { return "return"s; },
[](const BranchStmt &branchStatement) {
if (branchStatement.hasCondition()) {
- return "branch ("s +
- IntermediateRepresentation::dump(branchStatement.getCond()) +
+ return "branch ("s + FIR::dump(branchStatement.getCond()) +
") "s +
std::to_string(reinterpret_cast<std::intptr_t>(
branchStatement.getTrueSucc())) +
[](const AllocateStmt &) { return "alloc"s; },
[](const DeallocateStmt &) { return "dealloc"s; },
[](const AssignmentStmt &assignmentStatement) {
- auto computedValue{IntermediateRepresentation::dump(
- assignmentStatement.GetRightHandSide())};
- auto address{IntermediateRepresentation::dump(
- assignmentStatement.GetLeftHandSide())};
+ auto computedValue{
+ FIR::dump(assignmentStatement.GetRightHandSide())};
+ auto address{FIR::dump(assignmentStatement.GetLeftHandSide())};
return "assign ("s + computedValue + ") to "s + address;
},
[](const PointerAssignStmt &pointerAssignmentStatement) {
- auto computedAddress{IntermediateRepresentation::dump(
- pointerAssignmentStatement.GetRightHandSide())};
- auto address{IntermediateRepresentation::dump(
- pointerAssignmentStatement.GetLeftHandSide())};
+ auto computedAddress{
+ FIR::dump(pointerAssignmentStatement.GetRightHandSide())};
+ auto address{
+ FIR::dump(pointerAssignmentStatement.GetLeftHandSide())};
return "assign &("s + computedAddress + ") to "s + address;
},
[](const LabelAssignStmt &) { return "lblassn"s; },
},
[](const evaluate::GenericExprWrapper
*genericExpressionWrapper) {
- return IntermediateRepresentation::dump(
- genericExpressionWrapper);
+ return FIR::dump(genericExpressionWrapper);
},
},
expressionStatement.u);
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef FORTRAN_INTERMEDIATEREPRESENTATION_STATEMENTS_H_
-#define FORTRAN_INTERMEDIATEREPRESENTATION_STATEMENTS_H_
+#ifndef FORTRAN_FIR_STATEMENTS_H_
+#define FORTRAN_FIR_STATEMENTS_H_
#include "common.h"
#include "mixin.h"
#include <initializer_list>
#include <ostream>
-namespace Fortran::IntermediateRepresentation {
+namespace Fortran::FIR {
#define HANDLE_STMT(num, opcode, name) struct name;
#include "statement.def"
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef FORTRAN_INTERMEDIATEREPRESENTATION_STMT_H_
-#define FORTRAN_INTERMEDIATEREPRESENTATION_STMT_H_
+#ifndef FORTRAN_FIR_STMT_H_
+#define FORTRAN_FIR_STMT_H_
#include "basicblock.h"
#include "mixin.h"
#include "statements.h"
-namespace Fortran::IntermediateRepresentation {
+namespace Fortran::FIR {
/// Sum type over all statement classes
struct Statement : public SumTypeMixin<std::variant<