| 
									
										
										
										
											2014-11-07 13:02:14 -05:00
										 |  |  | USING: accessors assocs compiler.cfg.utilities compiler.cfg | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | compiler.cfg.branch-splitting compiler.cfg.debugger | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | compiler.cfg.predecessors compiler.cfg.rpo compiler.cfg.instructions fry kernel | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | tools.test namespaces sequences vectors ;
 | 
					
						
							|  |  |  | IN: compiler.cfg.branch-splitting.tests | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : get-predecessors ( cfg -- assoc )
 | 
					
						
							|  |  |  |     H{ } clone [ '[ [ predecessors>> ] keep _ set-at ] each-basic-block ] keep ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : check-predecessors ( cfg -- )
 | 
					
						
							|  |  |  |     [ get-predecessors ] | 
					
						
							| 
									
										
										
										
											2014-12-10 12:24:12 -05:00
										 |  |  |     [ needs-predecessors ] | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  |     [ get-predecessors ] tri assert= ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : check-branch-splitting ( cfg -- )
 | 
					
						
							| 
									
										
										
										
											2014-12-10 12:24:12 -05:00
										 |  |  |     [ needs-predecessors ] [ split-branches ] [ check-predecessors ] tri ;
 | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : test-branch-splitting ( -- )
 | 
					
						
							| 
									
										
										
										
											2014-11-07 13:02:14 -05:00
										 |  |  |     0 get block>cfg check-branch-splitting ;
 | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 0 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 1 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 2 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 3 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 4 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | test-diamond | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ test-branch-splitting ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 0 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 1 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 2 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 3 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 4 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 5 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-02 04:49:25 -04:00
										 |  |  | 0 { 1 2 } edges | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-02 04:49:25 -04:00
										 |  |  | 1 { 3 4 } edges | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-02 04:49:25 -04:00
										 |  |  | 2 { 3 4 } edges | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ ] [ test-branch-splitting ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 0 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 1 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 2 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 3 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 4 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-02 04:49:25 -04:00
										 |  |  | 0 { 1 2 } edges | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-02 04:49:25 -04:00
										 |  |  | 1 { 3 4 } edges | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-02 04:49:25 -04:00
										 |  |  | 2 4 edge | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ ] [ test-branch-splitting ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 0 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 1 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 19:29:40 -04:00
										 |  |  | V{ T{ ##branch } } 2 test-bb | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-02 04:49:25 -04:00
										 |  |  | 0 { 1 2 } edges | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-02 04:49:25 -04:00
										 |  |  | 1 2 edge | 
					
						
							| 
									
										
										
										
											2009-07-13 11:44:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-07 13:02:14 -05:00
										 |  |  | [ ] [ test-branch-splitting ] unit-test |