Daniel Cederman 82194ab97d [Sparc] Add support for 13-bit PIC
Summary: When compiling with -fpic, in contrast to -fPIC, use only the
immediate field to index into the GOT. This saves space if the GOT is
known to be small. The linker will warn if the GOT is too large for
this method.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: brad, fedor.sergeev, jrtc27, llvm-commits

Differential Revision: https://reviews.llvm.org/D47136

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334383 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11 05:50:08 +00:00

15 lines
276 B
LLVM

; RUN: llc < %s -relocation-model=pic -mtriple=sparc | FileCheck %s
@value = external global i32
define i32 @test() nounwind {
; CHECK: ld [%i0+value], %i0
entry:
%0 = load i32, i32* @value
ret i32 %0
}
!llvm.module.flags = !{!0}
!0 = !{i32 7, !"PIC Level", i32 1}