Introduce globalsym_addr.
This is an instruction used in legalization of GlobalVarData::Sym global variables.
This commit is contained in:
@@ -12,6 +12,8 @@ function %I32() {
|
||||
fn0 = function %foo()
|
||||
sig0 = ()
|
||||
|
||||
gv0 = globalsym %some_gv
|
||||
|
||||
ss0 = incoming_arg 8, offset 0
|
||||
ss1 = incoming_arg 1024, offset -1024
|
||||
ss2 = incoming_arg 1024, offset -2048
|
||||
@@ -342,9 +344,9 @@ ebb0:
|
||||
; asm: call foo
|
||||
call fn0() ; bin: e8 PCRel4(fn0) 00000000
|
||||
|
||||
; asm: movl $-1, %ecx
|
||||
; asm: movl $0, %ecx
|
||||
[-,%rcx] v400 = func_addr.i32 fn0 ; bin: b9 Abs4(fn0) 00000000
|
||||
; asm: movl $-1, %esi
|
||||
; asm: movl $0, %esi
|
||||
[-,%rsi] v401 = func_addr.i32 fn0 ; bin: be Abs4(fn0) 00000000
|
||||
|
||||
; asm: call *%ecx
|
||||
@@ -352,6 +354,11 @@ ebb0:
|
||||
; asm: call *%esi
|
||||
call_indirect sig0, v401() ; bin: ff d6
|
||||
|
||||
; asm: movl $0, %ecx
|
||||
[-,%rcx] v450 = globalsym_addr.i32 gv0 ; bin: b9 Abs4(gv0) 00000000
|
||||
; asm: movl $0, %esi
|
||||
[-,%rsi] v451 = globalsym_addr.i32 gv0 ; bin: be Abs4(gv0) 00000000
|
||||
|
||||
; Spill / Fill.
|
||||
|
||||
; asm: movl %ecx, 1032(%esp)
|
||||
|
||||
@@ -14,6 +14,8 @@ function %I64() {
|
||||
fn0 = function %foo()
|
||||
sig0 = ()
|
||||
|
||||
gv0 = globalsym %some_gv
|
||||
|
||||
; Use incoming_arg stack slots because they won't be relocated by the frame
|
||||
; layout.
|
||||
ss0 = incoming_arg 8, offset 0
|
||||
@@ -429,11 +431,11 @@ ebb0:
|
||||
; asm: call foo
|
||||
call fn0() ; bin: e8 PCRel4(fn0) 00000000
|
||||
|
||||
; asm: movabsq $-1, %rcx
|
||||
; asm: movabsq $0, %rcx
|
||||
[-,%rcx] v400 = func_addr.i64 fn0 ; bin: 48 b9 Abs8(fn0) 0000000000000000
|
||||
; asm: movabsq $-1, %rsi
|
||||
; asm: movabsq $0, %rsi
|
||||
[-,%rsi] v401 = func_addr.i64 fn0 ; bin: 48 be Abs8(fn0) 0000000000000000
|
||||
; asm: movabsq $-1, %r10
|
||||
; asm: movabsq $0, %r10
|
||||
[-,%r10] v402 = func_addr.i64 fn0 ; bin: 49 ba Abs8(fn0) 0000000000000000
|
||||
|
||||
; asm: call *%rcx
|
||||
@@ -443,6 +445,13 @@ ebb0:
|
||||
; asm: call *%r10
|
||||
call_indirect sig0, v402() ; bin: 41 ff d2
|
||||
|
||||
; asm: movabsq $-1, %rcx
|
||||
[-,%rcx] v450 = globalsym_addr.i64 gv0 ; bin: 48 b9 Abs8(gv0) 0000000000000000
|
||||
; asm: movabsq $-1, %rsi
|
||||
[-,%rsi] v451 = globalsym_addr.i64 gv0 ; bin: 48 be Abs8(gv0) 0000000000000000
|
||||
; asm: movabsq $-1, %r10
|
||||
[-,%r10] v452 = globalsym_addr.i64 gv0 ; bin: 49 ba Abs8(gv0) 0000000000000000
|
||||
|
||||
; Spill / Fill.
|
||||
|
||||
; asm: movq %rcx, 1032(%rsp)
|
||||
|
||||
@@ -29,6 +29,19 @@ ebb1(v1: i64):
|
||||
; check: return $v2
|
||||
}
|
||||
|
||||
function %sym() -> i64 {
|
||||
gv0 = globalsym %something
|
||||
gv1 = globalsym #d0bad180d0b5d182d0bed0bd
|
||||
|
||||
ebb1:
|
||||
v0 = global_addr.i64 gv0
|
||||
; check: $v0 = globalsym_addr.i64 gv0
|
||||
v1 = global_addr.i64 gv1
|
||||
; check: $v1 = globalsym_addr.i64 gv1
|
||||
v2 = bxor v0, v1
|
||||
return v2
|
||||
}
|
||||
|
||||
; SpiderMonkey VM-style static 4+2 GB heap.
|
||||
; This eliminates bounds checks completely for offsets < 2GB.
|
||||
function %staticheap_sm64(i32, i64 vmctx) -> f32 spiderwasm {
|
||||
|
||||
@@ -79,6 +79,10 @@ impl binemit::CodeSink for TextSink {
|
||||
write!(self.text, "{}({}) ", self.rnames[reloc.0 as usize], fref).unwrap();
|
||||
}
|
||||
|
||||
fn reloc_globalsym(&mut self, reloc: binemit::Reloc, global: ir::GlobalVar) {
|
||||
write!(self.text, "{}({}) ", self.rnames[reloc.0 as usize], global).unwrap();
|
||||
}
|
||||
|
||||
fn reloc_jt(&mut self, reloc: binemit::Reloc, jt: ir::JumpTable) {
|
||||
write!(self.text, "{}({}) ", self.rnames[reloc.0 as usize], jt).unwrap();
|
||||
}
|
||||
|
||||
@@ -99,5 +99,6 @@ impl binemit::CodeSink for SizeSink {
|
||||
|
||||
fn reloc_ebb(&mut self, _reloc: binemit::Reloc, _ebb: ir::Ebb) {}
|
||||
fn reloc_func(&mut self, _reloc: binemit::Reloc, _fref: ir::FuncRef) {}
|
||||
fn reloc_globalsym(&mut self, _reloc: binemit::Reloc, _global: ir::GlobalVar) {}
|
||||
fn reloc_jt(&mut self, _reloc: binemit::Reloc, _jt: ir::JumpTable) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user