[flang-commits] [flang] 7e82379 - [flang] rename PPC specific intrinsic modules (NFC)

Kelvin Li via flang-commits flang-commits at lists.llvm.org
Wed Jun 14 08:21:15 PDT 2023


Author: Kelvin Li
Date: 2023-06-14T11:21:03-04:00
New Revision: 7e82379d11f6d7072fd08b3023353ee791c8fb3e

URL: https://github.com/llvm/llvm-project/commit/7e82379d11f6d7072fd08b3023353ee791c8fb3e
DIFF: https://github.com/llvm/llvm-project/commit/7e82379d11f6d7072fd08b3023353ee791c8fb3e.diff

LOG: [flang] rename PPC specific intrinsic modules (NFC)

Added: 
    flang/module/__ppc_intrinsics.f90
    flang/module/__ppc_types.f90

Modified: 
    flang/include/flang/Semantics/semantics.h
    flang/lib/Semantics/resolve-names.cpp
    flang/lib/Semantics/semantics.cpp
    flang/tools/f18/CMakeLists.txt

Removed: 
    flang/module/__fortran_ppc_intrinsics.f90
    flang/module/__fortran_ppc_types.f90


################################################################################
diff  --git a/flang/include/flang/Semantics/semantics.h b/flang/include/flang/Semantics/semantics.h
index 48f37b7d4ce92..fee49b37f9f31 100644
--- a/flang/include/flang/Semantics/semantics.h
+++ b/flang/include/flang/Semantics/semantics.h
@@ -215,9 +215,9 @@ class SemanticsContext {
   void UseFortranBuiltinsModule();
   const Scope *GetBuiltinsScope() const { return builtinsScope_; }
 
-  void UsePPCFortranBuiltinTypesModule();
+  void UsePPCBuiltinTypesModule();
   const Scope &GetCUDABuiltinsScope();
-  void UsePPCFortranBuiltinsModule();
+  void UsePPCBuiltinsModule();
   Scope *GetPPCBuiltinTypesScope() { return ppcBuiltinTypesScope_; }
   const Scope *GetPPCBuiltinsScope() const { return ppcBuiltinsScope_; }
 

diff  --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 45d94313f2321..8e92e37cc33fa 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -4917,13 +4917,13 @@ void DeclarationVisitor::Post(const parser::VectorTypeSpec &x) {
 
   auto ppcBuiltinTypesScope = currScope().context().GetPPCBuiltinTypesScope();
   if (!ppcBuiltinTypesScope) {
-    common::die("INTERNAL: The __fortran_ppc_types module was not found ");
+    common::die("INTERNAL: The __ppc_types module was not found ");
   }
 
   auto iter{ppcBuiltinTypesScope->find(
       semantics::SourceName{typeName.data(), typeName.size()})};
   if (iter == ppcBuiltinTypesScope->cend()) {
-    common::die("INTERNAL: The __fortran_ppc_types module does not define "
+    common::die("INTERNAL: The __ppc_types module does not define "
                 "the type '%s'",
         typeName.data());
   }
@@ -4941,7 +4941,7 @@ void DeclarationVisitor::Post(const parser::VectorTypeSpec &x) {
       extant{ppcBuiltinTypesScope->FindInstantiatedDerivedType(
           vectorDerivedType, DeclTypeSpec::Category::TypeDerived)}) {
     // This derived type and parameter expressions (if any) are already present
-    // in the __fortran_ppc_intrinsics scope.
+    // in the __ppc_intrinsics scope.
     SetDeclTypeSpec(*extant);
   } else {
     DeclTypeSpec &type{ppcBuiltinTypesScope->MakeDerivedType(

diff  --git a/flang/lib/Semantics/semantics.cpp b/flang/lib/Semantics/semantics.cpp
index 428dadb539e8f..b5ea772c5d100 100644
--- a/flang/lib/Semantics/semantics.cpp
+++ b/flang/lib/Semantics/semantics.cpp
@@ -479,9 +479,9 @@ void SemanticsContext::UseFortranBuiltinsModule() {
   }
 }
 
-void SemanticsContext::UsePPCFortranBuiltinTypesModule() {
+void SemanticsContext::UsePPCBuiltinTypesModule() {
   if (ppcBuiltinTypesScope_ == nullptr) {
-    ppcBuiltinTypesScope_ = GetBuiltinModule("__fortran_ppc_types");
+    ppcBuiltinTypesScope_ = GetBuiltinModule("__ppc_types");
   }
 }
 
@@ -493,9 +493,9 @@ const Scope &SemanticsContext::GetCUDABuiltinsScope() {
   return **cudaBuiltinsScope_;
 }
 
-void SemanticsContext::UsePPCFortranBuiltinsModule() {
+void SemanticsContext::UsePPCBuiltinsModule() {
   if (ppcBuiltinsScope_ == nullptr) {
-    ppcBuiltinsScope_ = GetBuiltinModule("__fortran_ppc_intrinsics");
+    ppcBuiltinsScope_ = GetBuiltinModule("__ppc_intrinsics");
   }
 }
 
@@ -515,21 +515,21 @@ bool Semantics::Perform() {
                     .statement.v.source == "__fortran_builtins" ||
             std::get<parser::Statement<parser::ModuleStmt>>(
                 frontModule->value().t)
-                    .statement.v.source == "__fortran_ppc_types")) {
+                    .statement.v.source == "__ppc_types")) {
       // Don't try to read the builtins module when we're actually building it.
     } else if (frontModule &&
         std::get<parser::Statement<parser::ModuleStmt>>(frontModule->value().t)
                 .statement.v.source == "__fortran_ppc_intrinsics") {
       // The derived type definition for the vectors is needed.
-      context_.UsePPCFortranBuiltinTypesModule();
+      context_.UsePPCBuiltinTypesModule();
     } else {
       context_.UseFortranBuiltinsModule();
       llvm::Triple targetTriple{llvm::Triple(
           llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple()))};
-      // Only use __Fortran_PPC_intrinsics module when targetting PowerPC arch
+      // Only use __ppc_intrinsics module when targetting PowerPC arch
       if (context_.targetCharacteristics().isPPC()) {
-        context_.UsePPCFortranBuiltinTypesModule();
-        context_.UsePPCFortranBuiltinsModule();
+        context_.UsePPCBuiltinTypesModule();
+        context_.UsePPCBuiltinsModule();
       }
     }
   }

diff  --git a/flang/module/__fortran_ppc_intrinsics.f90 b/flang/module/__ppc_intrinsics.f90
similarity index 98%
rename from flang/module/__fortran_ppc_intrinsics.f90
rename to flang/module/__ppc_intrinsics.f90
index bcaef97422bd2..c39306fe934ce 100644
--- a/flang/module/__fortran_ppc_intrinsics.f90
+++ b/flang/module/__ppc_intrinsics.f90
@@ -1,4 +1,4 @@
-!===-- module/__fortran_ppc_intrinsics.f90 ---------------------------------===!
+!===-- module/__ppc_intrinsics.f90 -----------------------------------------===!
 !
 ! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 ! See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
 !
 !===------------------------------------------------------------------------===!
 
-module __Fortran_PPC_intrinsics
+module __ppc_intrinsics
 
   private
 
@@ -281,4 +281,4 @@ end function func_r8r8i
 #undef VR_VR_VR
 #undef VU_VU_VU
 #undef VI_VI_VI
-end module __Fortran_PPC_intrinsics
+end module __ppc_intrinsics

diff  --git a/flang/module/__fortran_ppc_types.f90 b/flang/module/__ppc_types.f90
similarity index 88%
rename from flang/module/__fortran_ppc_types.f90
rename to flang/module/__ppc_types.f90
index 9eea95159ce11..d446556b53999 100644
--- a/flang/module/__fortran_ppc_types.f90
+++ b/flang/module/__ppc_types.f90
@@ -1,4 +1,4 @@
-!===-- module/__fortran_ppc_types.f90----- ---------------------------------===!
+!===-- module/__ppc_types.f90 ----------------------------------------------===!
 !
 ! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 ! See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
 !
 !===------------------------------------------------------------------------===!
 
-module __Fortran_PPC_types
+module __ppc_types
   private
   ! Definition of derived-types that represent PowerPC vector types.
   type __builtin_ppc_intrinsic_vector(element_category, element_kind)
@@ -30,4 +30,4 @@
   public :: __builtin_ppc_pair_vector
   public :: __builtin_ppc_quad_vector
 
-end module __Fortran_PPC_types
+end module __ppc_types

diff  --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index 7a22bbef555d7..39272ccd5828d 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -8,8 +8,8 @@ set(MODULES
   "__fortran_builtins"
   "__fortran_ieee_exceptions"
   "__fortran_type_info"
-  "__fortran_ppc_types"
-  "__fortran_ppc_intrinsics"
+  "__ppc_types"
+  "__ppc_intrinsics"
   "__cuda_builtins"
   "ieee_arithmetic"
   "ieee_exceptions"
@@ -30,10 +30,10 @@ if (NOT CMAKE_CROSSCOMPILING)
     set(base ${FLANG_INTRINSIC_MODULES_DIR}/${filename})
     if(${filename} STREQUAL "__fortran_builtins")
       set(depends "")
-    elseif(${filename} STREQUAL "__fortran_ppc_types")
+    elseif(${filename} STREQUAL "__ppc_types")
       set(depends "")
-    elseif(${filename} STREQUAL "__fortran_ppc_intrinsics")
-      set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_ppc_types.mod)
+    elseif(${filename} STREQUAL "__ppc_intrinsics")
+      set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__ppc_types.mod)
     else()
       set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_builtins.mod)
       if(NOT ${filename} STREQUAL "__fortran_type_info")
@@ -47,7 +47,7 @@ if (NOT CMAKE_CROSSCOMPILING)
 
     # The module contains PPC vector types that needs the PPC target.
     set(opts "")
-    if(${filename} STREQUAL "__fortran_ppc_intrinsics")
+    if(${filename} STREQUAL "__ppc_intrinsics")
       set(opts "--target=ppc64le")
     endif()
 


        


More information about the flang-commits mailing list