Skip to content

Commit

Permalink
[flang] rename PPC specific intrinsic modules (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkwli committed Jun 14, 2023
1 parent 887362d commit 7e82379
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions flang/include/flang/Semantics/semantics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_; }

Expand Down
6 changes: 3 additions & 3 deletions flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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(
Expand Down
18 changes: 9 additions & 9 deletions flang/lib/Semantics/semantics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand All @@ -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");
}
}

Expand All @@ -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();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
!===-- 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.
! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
!
!===------------------------------------------------------------------------===!

module __Fortran_PPC_intrinsics
module __ppc_intrinsics

private

Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
!===-- 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.
! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
!
!===------------------------------------------------------------------------===!

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)
Expand All @@ -30,4 +30,4 @@
public :: __builtin_ppc_pair_vector
public :: __builtin_ppc_quad_vector

end module __Fortran_PPC_types
end module __ppc_types
12 changes: 6 additions & 6 deletions flang/tools/f18/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")
Expand All @@ -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()

Expand Down

0 comments on commit 7e82379

Please sign in to comment.