-
Notifications
You must be signed in to change notification settings - Fork 31
(closes #2823) Parse unresolved symbols with parenthesis as calls #3041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 24 commits
dba1ab8
80aa841
e26c5c5
5b51132
595941d
9f90894
e45a130
91a0d7f
3749bca
eae3e6e
47e3b18
635cdd1
c7a5a03
cc0b8f1
386b1eb
8faf03c
b92b637
331f1bd
e6ea658
c0e3562
6df3dc3
340531f
e2f27ed
b6af656
49891dd
42bf61e
a447a4b
b330b2f
64a6772
55325c1
96951a6
333d478
c451530
7c7edc5
51d5eea
02b9a6f
4a3448c
9c636ef
8f3bd23
84b0a22
ea1bcee
e57f0f3
a216c53
21d8c29
a11fe64
b78e7c0
f46cefb
8773ddc
e5c3573
7e55a94
ee8afb3
8a6ac60
40f29e1
c28324a
ecb902e
202b7f1
fc609cb
6632e10
4026c97
af704f0
138c7ad
c358f7f
59aac22
00ee4f2
1a89942
40de2b7
ef8b27a
d17ea86
133626f
bfde076
706249e
0efe6ab
7944b23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,7 @@ | |
|
|
||
| from psyclone.psyir.frontend.fortran import FortranReader | ||
| from psyclone.psyir.nodes import ( | ||
| Call, ArrayReference, CodeBlock, Literal, Reference) | ||
| Call, CodeBlock, Literal, Reference, Routine) | ||
| from psyclone.psyir.symbols import ( | ||
| Symbol, DataTypeSymbol, StructureType, RoutineSymbol, ScalarType) | ||
| from psyclone.domain.common.algorithm import ( | ||
|
|
@@ -203,24 +203,23 @@ def validate(self, node, options=None): | |
| f"Problem with invoke name: {err}") from err | ||
| if node.argument_names[idx]: | ||
| pass | ||
| elif isinstance(arg, ArrayReference): | ||
| pass | ||
| elif isinstance(arg, Call): | ||
| if arg.symbol == arg.ancestor(Routine).symbol: | ||
| raise TransformationError( | ||
| f"The invoke call argument '{arg.symbol.name}' has " | ||
| f"been used as the Algorithm routine name. This is not" | ||
| f" allowed.") | ||
| elif isinstance(arg, CodeBlock): | ||
| # pylint: disable=protected-access | ||
| for fp2_node in arg._fp2_nodes: | ||
| self._validate_fp2_node(fp2_node) | ||
| else: | ||
| if isinstance(arg, Call): | ||
| info = ( | ||
| f"The invoke call argument '{arg.routine.name}' has " | ||
| f"been used as a routine name. This is not allowed.") | ||
| else: | ||
| info = ( | ||
| f"The arguments to this invoke call are expected to " | ||
| f"be kernel calls which are represented in generic " | ||
| f"PSyIR as CodeBlocks or ArrayReferences, but " | ||
| f"'{arg.debug_string()}' is of type " | ||
| f"'{type(arg).__name__}'.") | ||
| info = ( | ||
| f"The arguments to this invoke call are expected to " | ||
| f"be kernel calls which are represented in generic " | ||
| f"PSyIR as Calls or Codeblocks, but " | ||
| f"'{arg.debug_string()}' is of type " | ||
| f"'{type(arg).__name__}'.") | ||
| raise TransformationError( | ||
| f"Error in {self.name} transformation. {info}") | ||
|
|
||
|
|
@@ -247,10 +246,11 @@ def apply(self, call, index, options=None): | |
| if call.argument_names[idx]: | ||
| call_name = f"{call_arg.value}" | ||
| continue | ||
| elif isinstance(call_arg, ArrayReference): | ||
| # kernel misrepresented as ArrayReference | ||
| args = call_arg.pop_all_children() | ||
| type_symbol = call_arg.symbol | ||
| elif isinstance(call_arg, Call): | ||
| # Get the symbols and args to reconstruct it as a | ||
| # higer-abstraction AlgorithmInvokeCall node | ||
| type_symbol = call_arg.routine.symbol | ||
| args = call_arg.pop_all_children()[1:] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to use
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still need the pop_all_children as the arguments returns a slice which is not where I want to remove the items from. |
||
| arg_info.append((type_symbol, args)) | ||
| else: | ||
| # The validates check that this can only be a Codeblock with | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.