compiler.cfg.empty-blocks: remove unused pass
							parent
							
								
									ca4f442eaa
								
							
						
					
					
						commit
						4352902bb6
					
				| 
						 | 
				
			
			@ -1,47 +0,0 @@
 | 
			
		|||
! Copyright (C) 2008, 2009 Slava Pestov.
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
USING: kernel accessors sequences namespaces combinators
 | 
			
		||||
combinators.short-circuit classes vectors compiler.cfg
 | 
			
		||||
compiler.cfg.instructions compiler.cfg.rpo ;
 | 
			
		||||
IN: compiler.cfg.empty-blocks
 | 
			
		||||
 | 
			
		||||
<PRIVATE
 | 
			
		||||
 | 
			
		||||
: update-predecessor ( bb -- )
 | 
			
		||||
    ! We have to replace occurrences of bb with bb's successor
 | 
			
		||||
    ! in bb's predecessor's list of successors.
 | 
			
		||||
    dup predecessors>> first [
 | 
			
		||||
        [
 | 
			
		||||
            2dup eq? [ drop successors>> first ] [ nip ] if
 | 
			
		||||
        ] with map
 | 
			
		||||
    ] change-successors drop ;
 | 
			
		||||
 
 | 
			
		||||
: update-successor ( bb -- )
 | 
			
		||||
    ! We have to replace occurrences of bb with bb's predecessor
 | 
			
		||||
    ! in bb's sucessor's list of predecessors.
 | 
			
		||||
    dup successors>> first [
 | 
			
		||||
        [
 | 
			
		||||
            2dup eq? [ drop predecessors>> first ] [ nip ] if
 | 
			
		||||
        ] with map
 | 
			
		||||
    ] change-predecessors drop ;
 | 
			
		||||
 | 
			
		||||
SYMBOL: changed?
 | 
			
		||||
 | 
			
		||||
: delete-basic-block ( bb -- )
 | 
			
		||||
    [ update-predecessor ] [ update-successor ] bi
 | 
			
		||||
    changed? on ;
 | 
			
		||||
 
 | 
			
		||||
: delete-basic-block? ( bb -- ? )
 | 
			
		||||
    {
 | 
			
		||||
        [ instructions>> length 1 = ]
 | 
			
		||||
        [ predecessors>> length 1 = ]
 | 
			
		||||
        [ successors>> length 1 = ]
 | 
			
		||||
        [ instructions>> first ##branch? ]
 | 
			
		||||
    } 1&& ;
 | 
			
		||||
 | 
			
		||||
PRIVATE>
 | 
			
		||||
 | 
			
		||||
: delete-empty-blocks ( cfg -- cfg' )
 | 
			
		||||
    changed? off
 | 
			
		||||
    dup [ dup delete-basic-block? [ delete-basic-block ] [ drop ] if ] each-basic-block
 | 
			
		||||
    changed? get [ cfg-changed ] when ;
 | 
			
		||||
| 
						 | 
				
			
			@ -1,9 +1,8 @@
 | 
			
		|||
! Copyright (C) 2010 Slava Pestov.
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
USING: compiler.cfg.empty-blocks compiler.cfg.gc-checks
 | 
			
		||||
compiler.cfg.representations compiler.cfg.save-contexts
 | 
			
		||||
compiler.cfg.ssa.destruction compiler.cfg.build-stack-frame
 | 
			
		||||
compiler.cfg.linear-scan ;
 | 
			
		||||
USING: compiler.cfg.gc-checks compiler.cfg.representations
 | 
			
		||||
compiler.cfg.save-contexts compiler.cfg.ssa.destruction
 | 
			
		||||
compiler.cfg.build-stack-frame compiler.cfg.linear-scan ;
 | 
			
		||||
IN: compiler.cfg.finalization
 | 
			
		||||
 | 
			
		||||
: finalize-cfg ( cfg -- cfg' )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,6 @@ compiler.cfg.representations
 | 
			
		|||
compiler.cfg.gc-checks
 | 
			
		||||
compiler.cfg.save-contexts
 | 
			
		||||
compiler.cfg.ssa.destruction
 | 
			
		||||
compiler.cfg.empty-blocks
 | 
			
		||||
compiler.cfg.checker ;
 | 
			
		||||
IN: compiler.cfg.optimizer
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue