Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions src/FAST-Core-Tools/FASTAbstractVariableVersionSSA.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Class {
#name : 'FASTAbstractVariableVersionSSA',
#superclass : 'Object',
#instVars : [
'localDeclaration'
],
#category : 'FAST-Core-Tools-SSA',
#package : 'FAST-Core-Tools',
#tag : 'SSA'
}

{ #category : 'instance creation' }
FASTAbstractVariableVersionSSA class >> for: aFASTFortranVariable [

^self new
for: aFASTFortranVariable ;
yourself
]

{ #category : 'adding' }
FASTAbstractVariableVersionSSA >> addChoiceToPhi: aPhiVersion [

self subclassResponsibility
]

{ #category : 'instance creation' }
FASTAbstractVariableVersionSSA >> for: aCollection [
^ self subclassResponsibility
]

{ #category : 'testing' }
FASTAbstractVariableVersionSSA >> includes: aSSAVersion [

^ self subclassResponsibility
]

{ #category : 'accessing' }
FASTAbstractVariableVersionSSA >> localDeclaration [

^localDeclaration
]

{ #category : 'accessing' }
FASTAbstractVariableVersionSSA >> localDeclaration: anObject [

localDeclaration := anObject
]

{ #category : 'accessing' }
FASTAbstractVariableVersionSSA >> localDeclarationName [

^ localDeclaration localDeclarationName
]

{ #category : 'accessing' }
FASTAbstractVariableVersionSSA >> localUses [

^ self localDeclaration localUses select: [ :access | access ssaVersion includes: self ]
]

{ #category : 'accessing' }
FASTAbstractVariableVersionSSA >> name [
^ self subclassResponsibility
]
22 changes: 10 additions & 12 deletions src/FAST-Core-Tools/FASTVariablePhiVersionSSA.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'FASTVariablePhiVersionSSA',
#superclass : 'FASTVariableVersionSSA',
#superclass : 'FASTAbstractVariableVersionSSA',
#instVars : [
'choices'
],
Expand All @@ -25,29 +25,27 @@ FASTVariablePhiVersionSSA >> choices [
FASTVariablePhiVersionSSA >> for: aCollection [

localDeclaration := aCollection anyOne localDeclaration.
version := nil.

choices := OrderedCollection new.
aCollection do: [ :v | v addChoiceToPhi: self ]

]

{ #category : 'accessing' }
FASTVariablePhiVersionSSA >> name [
{ #category : 'testing' }
FASTVariablePhiVersionSSA >> includes: aSSAVersion [

^'phi(' ,
($, join: (choices collect: #name)) ,
')'
^ self choices includes: aSSAVersion
]

{ #category : 'accessing' }
FASTVariablePhiVersionSSA >> version [
FASTVariablePhiVersionSSA >> name [

^(choices collect: #version) max
^ 'phi(' , ($, join: (choices collect: #name)) , ')'
]

{ #category : 'accessing' }
FASTVariablePhiVersionSSA >> version: anObject [
FASTVariablePhiVersionSSA >> version [

self shouldNotImplement
self deprecated:
'It does not really makes sense to have a version for a Phi version. I propose to remove it once Fortran and Java SSA will not use this anymore.'.
^ (choices collect: #version) max
]
56 changes: 26 additions & 30 deletions src/FAST-Core-Tools/FASTVariableVersionSSA.class.st
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
Class {
#name : 'FASTVariableVersionSSA',
#superclass : 'Object',
#superclass : 'FASTAbstractVariableVersionSSA',
#instVars : [
'version',
'localDeclaration'
'version'
],
#category : 'FAST-Core-Tools-SSA',
#package : 'FAST-Core-Tools',
#tag : 'SSA'
}

{ #category : 'instance creation' }
FASTVariableVersionSSA class >> for: aFASTFortranVariable [

^self new
for: aFASTFortranVariable ;
yourself
]

{ #category : 'adding' }
FASTVariableVersionSSA >> addChoiceToPhi: aPhiVersion [

aPhiVersion choices add: self
]

{ #category : 'instance creation' }
FASTVariableVersionSSA >> for: aFASTFortranVariable [
FASTVariableVersionSSA >> for: aFASTNode [

localDeclaration := aFASTNode localDeclaration.
]

{ #category : 'testing' }
FASTVariableVersionSSA >> includes: aSSAVersion [

localDeclaration := aFASTFortranVariable localDeclaration.
^ self = aSSAVersion
]

{ #category : 'initialization' }
Expand All @@ -38,32 +35,31 @@ FASTVariableVersionSSA >> initialize [
version := 0
]

{ #category : 'accessing' }
FASTVariableVersionSSA >> localDeclaration [

^localDeclaration
]

{ #category : 'accessing' }
FASTVariableVersionSSA >> localDeclaration: anObject [

localDeclaration := anObject
]

{ #category : 'accessing' }
FASTVariableVersionSSA >> name [

^ String streamContents: [ :s |
s
nextPutAll: localDeclaration localDeclarationName;
nextPut: $_;
nextPutAll: version asString ]
s
nextPutAll: self localDeclarationName;
nextPut: $_;
nextPutAll: version asString ]
]

{ #category : 'instance creation' }
FASTVariableVersionSSA >> newVersionNumber [

^version := version + 1
^ version := version + 1
]

{ #category : 'printing' }
FASTVariableVersionSSA >> printOn: aStream [
"Generate a string representation of the receiver based on its instance variables."

super printOn: aStream.
aStream
nextPutAll: ' [';
print: self name;
nextPut: $]
]

{ #category : 'testing' }
Expand Down
7 changes: 7 additions & 0 deletions src/FAST-Core-Tools/MooseModel.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Extension { #name : 'MooseModel' }

{ #category : '*FAST-Core-Tools' }
MooseModel >> allSSAVersions [
"Return all SSA variable declarations"

^ (self entities collect: #ssaVersion as: IdentitySet) reject: #isNil
]

{ #category : '*FAST-Core-Tools' }
MooseModel >> fastHighligther [
^ FASTTextHighlighter
Expand Down
Loading