[PATCH] D12219: WebAssembly: Implement call

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 15:48:06 PDT 2015


jfb added a comment.

This is still a work in progress, I need to figure out this void function problem, and add tests.


================
Comment at: test/CodeGen/WebAssembly/call.ll:22
@@ +21,3 @@
+  ret void
+}
+
----------------
I'm a bit confused: functions without a return type don't work at the moment. They get eliminated by initial selection DAG:
```
=== call_void_nullary                                                    === call_i32_nullary                                                    
Initial selection DAG: BB#0 'call_void_nullary:'                         Initial selection DAG: BB#0 'call_i32_nullary:'                         
SelectionDAG has 7 nodes:                                                SelectionDAG has 7 nodes:                                               
  0x2e16db8: i32 = TargetConstant<0>                                       0x37d2ed8: i32 = TargetConstant<0>                                    
                                                                                                                                                 
    0x2de2880: ch = EntryToken                                                 0x379e9a0: ch = EntryToken                                        
                                                                                                                                                 
    0x2e16db8: <multiple use>                                                                                                                    
  0x2e16ee0: ch,glue = callseq_start 0x2de2880, 0x2e16db8 [ORD=2]                                                                                
                                                                                                                                                 
    0x2e16ee0: <multiple use>                                                                                                                    
    0x2e16c90: i32 = GlobalAddress<void ()* @void_nullary> 0 [ORD=2]                                                                             
                                                                                                                                                 
  0x2e17008: ch = WebAssemblyISD::CALL 0x2e16ee0, 0x2e16c90 [ORD=2]                                                                              
                                                                                                                                                 
      0x2e16ee0: <multiple use>                                                                                                                  
      0x2e16db8: <multiple use>                                                0x37d2ed8: <multiple use>                                         
                                                                             0x37d3000: ch,glue = callseq_start 0x379e9a0, 0x37d2ed8 [ORD=2]     
                                                                                                                                                 
                                                                             0x37d2db0: i32 = GlobalAddress<i32 ()* @i32_nullary> 0 [ORD=2]      
                                                                                                                                                 
                                                                           0x37d3128: i32,ch = WebAssemblyISD::CALL 0x37d3000, 0x37d2db0 [ORD=2] 
                                                                                                                                                 
                                                                               0x37d3128: <multiple use>                                         
      0x2e16db8: <multiple use>                                                0x37d2ed8: <multiple use>                                         
    0x2e17130: ch,glue = callseq_end 0x2e16ee0, 0x2e16db8, 0x2e16db8 [O        0x37d2ed8: <multiple use>                                         
RD=2]                                                                                                                                            
                                                                             0x37d3250: ch,glue = callseq_end 0x37d3128:1, 0x37d2ed8, 0x37d2ed8  
                                                                         [ORD=2]                                                                 
                                                                                                                                                 
                                                                             0x37d3128: <multiple use>                                           
  0x2e17258: ch = WebAssemblyISD::RETURN 0x2e17130 [ORD=3]                 0x37d3378: ch = WebAssemblyISD::RETURN 0x37d3250, 0x37d3128 [ORD=3]   
                                                                                                                                                 
                                                                                                                                                 
                                                                                                                                                 
Combining: 0x2e17258: ch = WebAssemblyISD::RETURN 0x2e17130 [ORD=3]      Combining: 0x37d3378: ch = WebAssemblyISD::RETURN 0x37d3250, 0x37d3128  
                                                                         [ORD=3]                                                                 
                                                                                                                                                 
Combining: 0x2e17130: ch,glue = callseq_end 0x2e16ee0, 0x2e16db8, 0x2e1  Combining: 0x37d3250: ch,glue = callseq_end 0x37d3128:1, 0x37d2ed8, 0x3 
6db8 [ORD=2]                                                             7d2ed8 [ORD=2]                                                          
                                                                                                                                                 
                                                                         Combining: 0x37d3128: i32,ch = WebAssemblyISD::CALL 0x37d3000, 0x37d2db 
                                                                         0 [ORD=2]                                                               
                                                                                                                                                 
Combining: 0x2e16ee0: ch,glue = callseq_start 0x2de2880, 0x2e16db8 [ORD  Combining: 0x37d3000: ch,glue = callseq_start 0x379e9a0, 0x37d2ed8 [ORD 
=2]                                                                      =2]                                                                     
                                                                                                                                                 
Combining: 0x2e16db8: i32 = TargetConstant<0>                            Combining: 0x37d2ed8: i32 = TargetConstant<0>                           
                                                                                                                                                 
                                                                         Combining: 0x37d2db0: i32 = GlobalAddress<i32 ()* @i32_nullary> 0 [ORD= 
                                                                         2]                                                                      
                                                                                                                                                 
Combining: 0x2de2880: ch = EntryToken                                    Combining: 0x379e9a0: ch = EntryToken                                   
```

I do set `hasSideEffects = 1` on calls, so that's unexpected!


http://reviews.llvm.org/D12219





More information about the llvm-commits mailing list