| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| ! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s | FileCheck %s | ||
| ! RUN: bbc -emit-hlfir -fopenmp -o - %s | FileCheck %s | ||
|
|
||
| subroutine s4 | ||
| type y3 | ||
| integer,allocatable::x | ||
| end type y3 | ||
| type(y3)::v | ||
| !$omp parallel | ||
| !$omp do private(v) | ||
| do i=1,10 | ||
| v%x=1 | ||
| end do | ||
| !$omp end do | ||
| !$omp end parallel | ||
| end subroutine s4 | ||
|
|
||
|
|
||
| ! CHECK-LABEL: func.func @_QPs4() { | ||
| ! Example of how the lowering for regular derived type variables: | ||
| ! CHECK: %[[VAL_8:.*]] = fir.alloca !fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}> {bindc_name = "v", uniq_name = "_QFs4Ev"} | ||
| ! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_8]] {uniq_name = "_QFs4Ev"} : (!fir.ref<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) -> (!fir.ref<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>, !fir.ref<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) | ||
| ! CHECK: %[[VAL_10:.*]] = fir.embox %[[VAL_9]]#1 : (!fir.ref<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) -> !fir.box<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>> | ||
| ! CHECK: %[[VAL_11:.*]] = fir.address_of | ||
| ! CHECK: %[[VAL_12:.*]] = arith.constant 4 : i32 | ||
| ! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_10]] : (!fir.box<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) -> !fir.box<none> | ||
| ! CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_11]] : (!fir.ref<!fir.char<1,{{.*}}>>) -> !fir.ref<i8> | ||
| ! CHECK: %[[VAL_15:.*]] = fir.call @_FortranAInitialize(%[[VAL_13]], %[[VAL_14]], %[[VAL_12]]) fastmath<contract> : (!fir.box<none>, !fir.ref<i8>, i32) -> none | ||
| ! CHECK: omp.parallel { | ||
| ! CHECK: %[[VAL_23:.*]] = fir.alloca !fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}> {bindc_name = "v", pinned, uniq_name = "_QFs4Ev"} | ||
| ! CHECK: %[[VAL_24:.*]]:2 = hlfir.declare %[[VAL_23]] {uniq_name = "_QFs4Ev"} : (!fir.ref<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) -> (!fir.ref<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>, !fir.ref<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) | ||
| ! CHECK: %[[VAL_25:.*]] = fir.embox %[[VAL_24]]#1 : (!fir.ref<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) -> !fir.box<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>> | ||
| ! CHECK: %[[VAL_26:.*]] = fir.address_of | ||
| ! CHECK: %[[VAL_27:.*]] = arith.constant 4 : i32 | ||
| ! CHECK: %[[VAL_28:.*]] = fir.convert %[[VAL_25]] : (!fir.box<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) -> !fir.box<none> | ||
| ! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_26]] : (!fir.ref<!fir.char<1,{{.*}}>>) -> !fir.ref<i8> | ||
| ! Check we do call FortranAInitialize on the derived type | ||
| ! CHECK: %[[VAL_30:.*]] = fir.call @_FortranAInitialize(%[[VAL_28]], %[[VAL_29]], %[[VAL_27]]) fastmath<contract> : (!fir.box<none>, !fir.ref<i8>, i32) -> none | ||
| ! CHECK: omp.wsloop { | ||
| ! CHECK: omp.terminator | ||
| ! CHECK: } | ||
| ! CHECK: %[[VAL_39:.*]] = fir.embox %[[VAL_9]]#1 : (!fir.ref<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) -> !fir.box<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>> | ||
| ! CHECK: %[[VAL_40:.*]] = fir.convert %[[VAL_39]] : (!fir.box<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) -> !fir.box<none> | ||
| ! Check the derived type is destroyed | ||
| ! CHECK: %[[VAL_41:.*]] = fir.call @_FortranADestroy(%[[VAL_40]]) fastmath<contract> : (!fir.box<none>) -> none | ||
| ! CHECK: return | ||
| ! CHECK: } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s -o - | FileCheck %s | ||
|
|
||
| module attributes {dlti.dl_spec = #dlti.dl_spec<>} { | ||
| func.func @_QMhelperPmod_sub(%arg0: !fir.ref<i32> {fir.bindc_name = "a"} ) { | ||
| return | ||
| } loc(#loc1) | ||
| func.func private @_QMhelperFmod_subPchild1(%arg0: !fir.ref<i32> {fir.bindc_name = "b"} ) attributes {fir.host_symbol = @_QMhelperPmod_sub, llvm.linkage = #llvm.linkage<internal>} { | ||
| return | ||
| } loc(#loc2) | ||
| func.func @global_sub_(%arg0: !fir.ref<i32> {fir.bindc_name = "n"} ) attributes {fir.internal_name = "_QPglobal_sub"} { | ||
| return | ||
| } loc(#loc3) | ||
| func.func private @_QFglobal_subPchild2(%arg0: !fir.ref<i32> {fir.bindc_name = "c"}) attributes {fir.host_symbol = @global_sub_, llvm.linkage = #llvm.linkage<internal>} { | ||
| return | ||
| } loc(#loc4) | ||
| } | ||
|
|
||
| #loc1 = loc("test.f90":5:1) | ||
| #loc2 = loc("test.f90":15:1) | ||
| #loc3 = loc("test.f90":25:1) | ||
| #loc4 = loc("test.f90":35:1) | ||
|
|
||
| // CHECK-DAG: #[[SP1:.*]] = #llvm.di_subprogram<{{.*}}name = "mod_sub"{{.*}}> | ||
| // CHECK-DAG: #llvm.di_subprogram<{{.*}}scope = #[[SP1]], name = "child1"{{.*}}> | ||
| // CHECK-DAG: #[[SP2:.*]] = #llvm.di_subprogram<{{.*}}linkageName = "global_sub_"{{.*}}> | ||
| // CHECK-DAG: #llvm.di_subprogram<{{.*}}scope = #[[SP2]], name = "child2"{{.*}}> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| //===-- ScriptedInterfaceUsages.h ---------------------------- -*- C++ -*-===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLDB_INTERPRETER_SCRIPTEDINTERFACEUSAGES_H | ||
| #define LLDB_INTERPRETER_SCRIPTEDINTERFACEUSAGES_H | ||
|
|
||
| #include "lldb/lldb-types.h" | ||
|
|
||
| #include "lldb/Utility/Stream.h" | ||
| #include "llvm/ADT/StringRef.h" | ||
|
|
||
| namespace lldb_private { | ||
| class ScriptedInterfaceUsages { | ||
| public: | ||
| ScriptedInterfaceUsages() = default; | ||
| ScriptedInterfaceUsages(const std::vector<llvm::StringRef> ci_usages, | ||
| const std::vector<llvm::StringRef> sbapi_usages) | ||
| : m_command_interpreter_usages(ci_usages), m_sbapi_usages(sbapi_usages) {} | ||
|
|
||
| const std::vector<llvm::StringRef> &GetCommandInterpreterUsages() const { | ||
| return m_command_interpreter_usages; | ||
| } | ||
|
|
||
| const std::vector<llvm::StringRef> &GetSBAPIUsages() const { | ||
| return m_sbapi_usages; | ||
| } | ||
|
|
||
| enum class UsageKind { CommandInterpreter, API }; | ||
|
|
||
| void Dump(Stream &s, UsageKind kind) const; | ||
|
|
||
| private: | ||
| std::vector<llvm::StringRef> m_command_interpreter_usages; | ||
| std::vector<llvm::StringRef> m_sbapi_usages; | ||
| }; | ||
| } // namespace lldb_private | ||
|
|
||
| #endif // LLDB_INTERPRETER_SCRIPTEDINTERFACEUSAGES_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| add_lldb_library(lldbInterpreterInterfaces NO_PLUGIN_DEPENDENCIES | ||
| ScriptedInterfaceUsages.cpp | ||
|
|
||
| LINK_LIBS | ||
| lldbUtility | ||
|
|
||
| LINK_COMPONENTS | ||
| Support | ||
| ) | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| //===-- ScriptedInterfaceUsages.cpp --------------------------------------===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "lldb/Interpreter/Interfaces/ScriptedInterfaceUsages.h" | ||
|
|
||
| using namespace lldb; | ||
| using namespace lldb_private; | ||
|
|
||
| void ScriptedInterfaceUsages::Dump(Stream &s, UsageKind kind) const { | ||
| s.IndentMore(); | ||
| s.Indent(); | ||
| llvm::StringRef usage_kind = | ||
| (kind == UsageKind::CommandInterpreter) ? "Command Interpreter" : "API"; | ||
| s << usage_kind << " Usages:"; | ||
| const std::vector<llvm::StringRef> &usages = | ||
| (kind == UsageKind::CommandInterpreter) ? GetCommandInterpreterUsages() | ||
| : GetSBAPIUsages(); | ||
| if (usages.empty()) | ||
| s << " None\n"; | ||
| else if (usages.size() == 1) | ||
| s << " " << usages.front() << '\n'; | ||
| else { | ||
| s << '\n'; | ||
| for (llvm::StringRef usage : usages) { | ||
| s.IndentMore(); | ||
| s.Indent(); | ||
| s << usage << '\n'; | ||
| s.IndentLess(); | ||
| } | ||
| } | ||
| s.IndentLess(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| add_lldb_library(lldbPluginScriptInterpreterPythonOperatingSystemPythonInterface PLUGIN | ||
|
|
||
| OperatingSystemPythonInterface.cpp | ||
|
|
||
| LINK_LIBS | ||
| lldbCore | ||
| lldbHost | ||
| lldbInterpreter | ||
| lldbTarget | ||
| lldbPluginScriptInterpreterPython | ||
| ${Python3_LIBRARIES} | ||
| ${LLDB_LIBEDIT_LIBS} | ||
|
|
||
| LINK_COMPONENTS | ||
| Support | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| add_lldb_library(lldbPluginScriptInterpreterPythonScriptedPlatformPythonInterface PLUGIN | ||
|
|
||
| ScriptedPlatformPythonInterface.cpp | ||
|
|
||
| LINK_LIBS | ||
| lldbCore | ||
| lldbHost | ||
| lldbInterpreter | ||
| lldbTarget | ||
| lldbPluginScriptInterpreterPython | ||
| ${Python3_LIBRARIES} | ||
| ${LLDB_LIBEDIT_LIBS} | ||
|
|
||
| LINK_COMPONENTS | ||
| Support | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| add_lldb_library(lldbPluginScriptInterpreterPythonScriptedProcessPythonInterface PLUGIN | ||
|
|
||
| ScriptedProcessPythonInterface.cpp | ||
|
|
||
| LINK_LIBS | ||
| lldbCore | ||
| lldbHost | ||
| lldbInterpreter | ||
| lldbTarget | ||
| lldbPluginScriptInterpreterPython | ||
| ${Python3_LIBRARIES} | ||
| ${LLDB_LIBEDIT_LIBS} | ||
|
|
||
| LINK_COMPONENTS | ||
| Support | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| add_lldb_library(lldbPluginScriptInterpreterPythonScriptedThreadPlanPythonInterface PLUGIN | ||
|
|
||
| ScriptedThreadPlanPythonInterface.cpp | ||
|
|
||
| LINK_LIBS | ||
| lldbCore | ||
| lldbHost | ||
| lldbInterpreter | ||
| lldbTarget | ||
| lldbPluginScriptInterpreterPython | ||
| ${Python3_LIBRARIES} | ||
| ${LLDB_LIBEDIT_LIBS} | ||
|
|
||
| LINK_COMPONENTS | ||
| Support | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| //===---- PPCTargetParser - Parser for target features ----------*- C++ -*-===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // This file implements a target parser to recognise hardware features | ||
| // for PPC CPUs. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_TARGETPARSER_PPCTARGETPARSER_H | ||
| #define LLVM_TARGETPARSER_PPCTARGETPARSER_H | ||
|
|
||
| #include "llvm/ADT/StringRef.h" | ||
| #include "llvm/TargetParser/Triple.h" | ||
|
|
||
| namespace llvm { | ||
| namespace PPC { | ||
| bool isValidCPU(StringRef CPU); | ||
| void fillValidCPUList(SmallVectorImpl<StringRef> &Values); | ||
| void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values); | ||
|
|
||
| // Get target CPU name. | ||
| // If CPUName is empty or generic, return the default CPU name. | ||
| // If CPUName is not empty or generic, return the normalized CPU name. | ||
| StringRef getNormalizedPPCTargetCPU(const Triple &T, StringRef CPUName = ""); | ||
|
|
||
| // Get the tune CPU name. | ||
| StringRef getNormalizedPPCTuneCPU(const Triple &T, StringRef CPUName = ""); | ||
|
|
||
| // For PPC, there are some cpu names for same CPU, like pwr10 and power10, | ||
| // normalize them. | ||
| StringRef normalizeCPUName(StringRef CPUName); | ||
| } // namespace PPC | ||
| } // namespace llvm | ||
|
|
||
| #endif |