@@ -104,24 +104,35 @@ def test_switch_limited_by_cmp(self):
104104 @unittest .skipUnless (
105105 platform .system () == "Linux" , "This test is linux only."
106106 )
107- def test_switch_limited_by_cmp_arm64 (self ):
107+ def test_switch_arm64 (self ):
108108 """
109- Ensure jump table propagation is limited by comparsions of the index
110- register.
109+ Test jump-table construction in various cases
111110 """
112- binary = Path ("ex" )
113- with cd (ex_arm64_asm_dir / "ex_switch_limited_by_cmp" ):
114- self .assertTrue (
115- compile (
116- "aarch64-linux-gnu-gcc" , "aarch64-linux-gnu-g++" , "-O0" , []
111+ ex_info = [
112+ ("ex_switch1" , "main" ),
113+ ("ex_switch2" , "main" ),
114+ ("ex_switch3" , ".jump" ),
115+ ("ex_switch4" , ".jump" ),
116+ ("ex_switch_limited_by_cmp" , ".jump" ),
117+ ]
118+ for example , symbol in ex_info :
119+ binary = Path ("ex" )
120+ with cd (ex_arm64_asm_dir / example ):
121+ self .assertTrue (
122+ compile (
123+ "aarch64-linux-gnu-gcc" ,
124+ "aarch64-linux-gnu-g++" ,
125+ "-O0" ,
126+ [],
127+ )
117128 )
118- )
119- ir_library = disassemble (binary ).ir ()
120- m = ir_library .modules [0 ]
129+ ir_library = disassemble (binary ).ir ()
130+ m = ir_library .modules [0 ]
121131
122- # check that the .jump has edges to only the four jump table entries
123- jump_sym = next (m .symbols_named (".jump" ))
124- self .assertEqual (len (list (jump_sym .referent .outgoing_edges )), 4 )
132+ # check that the symbol has edges to only the four jump table
133+ # entries
134+ jump_sym = next (m .symbols_named (symbol ))
135+ self .assertEqual (len (list (jump_sym .referent .outgoing_edges )), 4 )
125136
126137 @unittest .skipUnless (
127138 platform .system () == "Linux" , "This test is linux only."
0 commit comments