]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/cfg/alias-analysis/alias-analysis.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / compiler / cfg / alias-analysis / alias-analysis.factor
index 78e271c1f6267034f7033b92ef7a13bd8a73a801..526df79cb3018abd7eadfe5e6063d503eae4a48a 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel math namespaces assocs hashtables sequences arrays
-accessors vectors combinators sets classes compiler.cfg
+accessors vectors combinators sets classes cpu.architecture compiler.cfg
 compiler.cfg.registers compiler.cfg.instructions
-compiler.cfg.copy-prop compiler.cfg.rpo compiler.cfg.def-use ;
+compiler.cfg.copy-prop compiler.cfg.rpo compiler.cfg.liveness ;
 IN: compiler.cfg.alias-analysis
 
 ! We try to eliminate redundant slot operations using some simple heuristics.
@@ -144,7 +144,7 @@ ERROR: vreg-has-no-slots vreg ;
 SYMBOL: ac-counter
 
 : next-ac ( -- n )
-    ac-counter [ dup 1+ ] change ;
+    ac-counter [ dup 1 + ] change ;
 
 ! Alias class for objects which are loaded from the data stack
 ! or other object slots. We pessimistically assume that they
@@ -196,9 +196,6 @@ M: ##set-slot insn-object obj>> resolve ;
 M: ##set-slot-imm insn-object obj>> resolve ;
 M: ##alien-global insn-object drop \ ##alien-global ;
 
-: inputs ( insns -- seq )
-    [ [ ##phi? not ] filter gen-set ] [ kill-set ] bi assoc-diff keys ;
-
 : init-alias-analysis ( insns -- insns' )
     H{ } clone histories set
     H{ } clone vregs>acs set
@@ -210,7 +207,7 @@ M: ##alien-global insn-object drop \ ##alien-global ;
     0 ac-counter set
     next-ac heap-ac set
 
-    dup inputs [ set-heap-ac ] each ;
+    dup local-live-in [ set-heap-ac ] each ;
 
 GENERIC: analyze-aliases* ( insn -- insn' )
 
@@ -229,7 +226,7 @@ M: ##read analyze-aliases*
     call-next-method
     dup [ dst>> ] [ insn-slot# ] [ insn-object ] tri
     2dup live-slot dup [
-        2nip \ ##copy new-insn analyze-aliases* nip
+        2nip any-rep \ ##copy new-insn analyze-aliases* nip
     ] [
         drop remember-slot
     ] if ;
@@ -288,4 +285,4 @@ M: insn eliminate-dead-stores* ;
     eliminate-dead-stores ;
 
 : alias-analysis ( cfg -- cfg' )
-    [ alias-analysis-step ] local-optimization ;
\ No newline at end of file
+    [ alias-analysis-step ] local-optimization ;