mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
3d47402f2e
In ELF and COFF an alias is just another offset in a section. There is no way to represent an alias to something in another file. In MachO, the spec has the N_INDR type which should allow for exactly that, but is not currently implemented. Given that it is specified but not implemented, we error in codegen to avoid miscompiling but don't reject aliases to declarations in the verifier to leave the option open of implementing it. In the past we have used alias to declarations as a way of implementing weakref, which is why it exists in some old tests which this patch updates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194705 91177308-0d34-0410-b5e6-96231b3b80d8
35 lines
596 B
LLVM
35 lines
596 B
LLVM
; RUN: llc < %s -march=xcore | FileCheck %s
|
|
define void @a_val() nounwind {
|
|
ret void
|
|
}
|
|
@b_val = constant i32 42, section ".cp.rodata"
|
|
@c_val = global i32 42
|
|
|
|
@a = alias void ()* @a_val
|
|
@b = alias i32* @b_val
|
|
@c = alias i32* @c_val
|
|
|
|
; CHECK-LABEL: a_addr:
|
|
; CHECK: ldap r11, a
|
|
; CHECK: retsp
|
|
define void ()* @a_addr() nounwind {
|
|
entry:
|
|
ret void ()* @a
|
|
}
|
|
|
|
; CHECK-LABEL: b_addr:
|
|
; CHECK: ldaw r11, cp[b]
|
|
; CHECK: retsp
|
|
define i32 *@b_addr() nounwind {
|
|
entry:
|
|
ret i32* @b
|
|
}
|
|
|
|
; CHECK-LABEL: c_addr:
|
|
; CHECK: ldaw r0, dp[c]
|
|
; CHECK: retsp
|
|
define i32 *@c_addr() nounwind {
|
|
entry:
|
|
ret i32* @c
|
|
}
|