llvm.org GIT mirror llvm / 1e47725
[WebAssembly] Rename memory_size intrinsic to current_memory This follows the recent renaming in the wasm spec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268255 91177308-0d34-0410-b5e6-96231b3b80d8 Derek Schuff 3 years ago
4 changed file(s) with 21 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
1313
1414 let TargetPrefix = "wasm" in { // All intrinsics start with "llvm.wasm.".
1515
16 // Note that memory_size is not IntrNoMem because it must be sequenced with
16 // Note that current_memory is not IntrNoMem because it must be sequenced with
1717 // respect to grow_memory calls.
18 def int_wasm_memory_size : Intrinsic<[llvm_anyint_ty], [], [IntrReadMem]>;
18 def int_wasm_current_memory : Intrinsic<[llvm_anyint_ty], [], [IntrReadMem]>;
1919 def int_wasm_grow_memory : Intrinsic<[], [llvm_anyint_ty], []>;
2020
2121 }
669669
670670 let Defs = [ARGUMENTS] in {
671671
672 // Memory size.
673 def MEMORY_SIZE_I32 : I<(outs I32:$dst), (ins),
674 [(set I32:$dst, (int_wasm_memory_size))],
675 "memory_size\t$dst">,
676 Requires<[HasAddr32]>;
677 def MEMORY_SIZE_I64 : I<(outs I64:$dst), (ins),
678 [(set I64:$dst, (int_wasm_memory_size))],
679 "memory_size\t$dst">,
680 Requires<[HasAddr64]>;
672 // Current memory size.
673 def CURRENT_MEMORY_I32 : I<(outs I32:$dst), (ins),
674 [(set I32:$dst, (int_wasm_current_memory))],
675 "current_memory\t$dst">,
676 Requires<[HasAddr32]>;
677 def CURRENT_MEMORY_I64 : I<(outs I64:$dst), (ins),
678 [(set I64:$dst, (int_wasm_current_memory))],
679 "current_memory\t$dst">,
680 Requires<[HasAddr64]>;
681681
682682 // Grow memory.
683683 def GROW_MEMORY_I32 : I<(outs), (ins I32:$delta),
44 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
55 target triple = "wasm32-unknown-unknown"
66
7 declare i32 @llvm.wasm.memory.size.i32() nounwind readonly
7 declare i32 @llvm.wasm.current.memory.i32() nounwind readonly
88 declare void @llvm.wasm.grow.memory.i32(i32) nounwind
99
10 ; CHECK-LABEL: memory_size:
10 ; CHECK-LABEL: current_memory:
1111 ; CHECK-NEXT: .result i32{{$}}
12 ; CHECK-NEXT: memory_size $push0={{$}}
12 ; CHECK-NEXT: current_memory $push0={{$}}
1313 ; CHECK-NEXT: return $pop0{{$}}
14 define i32 @memory_size() {
15 %a = call i32 @llvm.wasm.memory.size.i32()
14 define i32 @current_memory() {
15 %a = call i32 @llvm.wasm.current.memory.i32()
1616 ret i32 %a
1717 }
1818
44 target datalayout = "e-m:e-p:64:64-i64:64-n32:64-S128"
55 target triple = "wasm64-unknown-unknown"
66
7 declare i64 @llvm.wasm.memory.size.i64() nounwind readonly
7 declare i64 @llvm.wasm.current.memory.i64() nounwind readonly
88 declare void @llvm.wasm.grow.memory.i64(i64) nounwind
99
10 ; CHECK-LABEL: memory_size:
10 ; CHECK-LABEL: current_memory:
1111 ; CHECK-NEXT: .result i64{{$}}
12 ; CHECK-NEXT: memory_size $push0={{$}}
12 ; CHECK-NEXT: current_memory $push0={{$}}
1313 ; CHECK-NEXT: return $pop0{{$}}
14 define i64 @memory_size() {
15 %a = call i64 @llvm.wasm.memory.size.i64()
14 define i64 @current_memory() {
15 %a = call i64 @llvm.wasm.current.memory.i64()
1616 ret i64 %a
1717 }
1818