Use large-model addressing for calls when in non-PIC mode.

The main use for non-PIC code at present is JIT code, and JIT code can
live anywhere in memory and reference other symbols defined anywhere in
memory, so it needs to use the "large" code model.

func_addr and globalsym_addr instructions were already using `movabs`
to support arbitrary 64-bit addresses, so this just makes calls be
legalized to support arbitrary 64-bit addresses also.
This commit is contained in:
Dan Gohman
2018-04-09 14:53:00 -07:00
parent 2703b8ce6f
commit eab57c0a40
7 changed files with 72 additions and 3 deletions

View File

@@ -473,8 +473,11 @@ ebb0:
; asm: movzbq %dl, %rsi
[-,%rsi] v351 = bint.i64 v301 ; bin: 0f b6 f2
; asm: call foo
call fn0() ; bin: e8 PCRel4(%foo-4) 00000000
; TODO: x86-64 can't encode a direct call to an arbitrary 64-bit address in
; a single instruction. When we add a concept of colocated definitions, this
; test can be re-enabled.
; disabled: asm: call foo
; disabled: call fn0() ; bin: e8 PCRel4(%foo-4) 00000000
; asm: movabsq $0, %rcx
[-,%rcx] v400 = func_addr.i64 fn0 ; bin: 48 b9 Abs8(%foo) 0000000000000000

View File

@@ -2,6 +2,7 @@ test legalizer
; Pre-SSE 4.1, we need to use runtime library calls for floating point rounding operations.
set is_64bit
set is_pic
isa intel
function %floor(f32) -> f32 {

View File

@@ -1,6 +1,7 @@
test compile
set is_64bit
set is_compressed
set is_pic
isa intel haswell
; An empty function.