Skip to content

Commit

Permalink
POWER: refactor ?store evaluators
Browse files Browse the repository at this point in the history
...to use common helper.
  • Loading branch information
janvrany authored and shingarov committed Nov 28, 2023
1 parent 3aa53ea commit c1e26b1
Showing 1 changed file with 45 additions and 6 deletions.
51 changes: 45 additions & 6 deletions src/Tinyrossa-POWER/TRPPC64CodeEvaluator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,30 @@ TRPPC64CodeEvaluator >> commonLoad: node [
^dstReg.
]

{ #category : #'evaluation-helpers' }
TRPPC64CodeEvaluator >> commonStore: node [
"Handles astore, lstore, istore, sstore & bstore"

| srcReg offset type |

offset := (AcDSLSymbol value: node symbol name).
srcReg := self evaluate: node child1.

type := node type.
(type == Address or:[type == Int64]) ifTrue:[
self shouldImplement
] ifFalse:[ type == Int32 ifTrue:[
generate
stw: srcReg, (gr1 + offset).
] ifFalse:[ type == Int16 ifTrue:[
self shouldImplement
] ifFalse:[ type == Int8 ifTrue:[
self shouldImplement
]]]].

^nil.
]

{ #category : #evaluation }
TRPPC64CodeEvaluator >> evaluate_aconst: node [
^self evaluate_lconst: node
Expand All @@ -43,6 +67,11 @@ TRPPC64CodeEvaluator >> evaluate_aload: node [
^ self commonLoad: node
]

{ #category : #evaluation }
TRPPC64CodeEvaluator >> evaluate_astore: node [
^ self commonStore: node
]

{ #category : #evaluation }
TRPPC64CodeEvaluator >> evaluate_bconst: node [
^ self evaluate_iconst: node
Expand All @@ -53,6 +82,11 @@ TRPPC64CodeEvaluator >> evaluate_bload: node [
^ self commonLoad: node
]

{ #category : #evaluation }
TRPPC64CodeEvaluator >> evaluate_bstore: node [
^ self commonStore: node
]

{ #category : #evaluation }
TRPPC64CodeEvaluator >> evaluate_goto: node [
generate b: node symbol.
Expand Down Expand Up @@ -185,12 +219,7 @@ TRPPC64CodeEvaluator >> evaluate_imul: node [

{ #category : #evaluation }
TRPPC64CodeEvaluator >> evaluate_istore: node [
| symbol srcReg |

symbol := node symbol.
srcReg := self evaluate: node child1.
generate stw: srcReg, (gr1 + (AcDSLSymbol value: symbol name)).
^ nil
^ self commonStore: node
]

{ #category : #evaluation }
Expand Down Expand Up @@ -229,6 +258,11 @@ TRPPC64CodeEvaluator >> evaluate_lload: node [
^ self commonLoad: node
]

{ #category : #evaluation }
TRPPC64CodeEvaluator >> evaluate_lstore: node [
^ self commonStore: node
]

{ #category : #evaluation }
TRPPC64CodeEvaluator >> evaluate_sconst: node [
^ self evaluate_iconst: node
Expand All @@ -238,3 +272,8 @@ TRPPC64CodeEvaluator >> evaluate_sconst: node [
TRPPC64CodeEvaluator >> evaluate_sload: node [
^ self commonLoad: node
]

{ #category : #evaluation }
TRPPC64CodeEvaluator >> evaluate_sstore: node [
^ self commonStore: node
]

0 comments on commit c1e26b1

Please sign in to comment.