IRFunction.st
changeset 29 2f154b67e1e8
parent 28 2eab5fdb9467
child 30 1b7ff9c8c40b
--- a/IRFunction.st	Mon Feb 15 17:55:26 2010 +0000
+++ b/IRFunction.st	Tue Mar 23 13:38:08 2010 +0000
@@ -50,6 +50,23 @@
     "Modified: / 12-08-2009 / 09:22:05 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
+addTempsIfNotDefined: temps
+
+    | ir tempsToAdd |
+    ir := self.
+    tempsToAdd := temps asSet.
+    [ ir isNil ] whileFalse: 
+        [ir tempNames do:
+            [:temp|
+            (tempsToAdd includes:temp)
+                ifTrue:[tempsToAdd := tempsToAdd remove: temp]].
+        ir := ir environmentIr].
+    tempsToAdd isEmpty ifTrue:[^self].
+    self addTemps: tempsToAdd
+
+    "Created: / 23-03-2010 / 13:51:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 additionalLiterals
 	^additionalLiterals.
 !
@@ -93,6 +110,10 @@
 	^self allInstructionsMatching: [:bc | bc isTempStore].
 !
 
+environmentIr
+    ^ environmentIr
+!
+
 ir
 	^self.
 !