mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Honour setHasCalls() set from isel.
This is used in some weird cases like general dynamic TLS model. This fixes PR5723 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91144 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0291d7ed09
commit
817a46454a
@ -136,9 +136,10 @@ void PEI::getAnalysisUsage(AnalysisUsage &AU) const {
|
|||||||
/// pseudo instructions.
|
/// pseudo instructions.
|
||||||
void PEI::calculateCallsInformation(MachineFunction &Fn) {
|
void PEI::calculateCallsInformation(MachineFunction &Fn) {
|
||||||
const TargetRegisterInfo *RegInfo = Fn.getTarget().getRegisterInfo();
|
const TargetRegisterInfo *RegInfo = Fn.getTarget().getRegisterInfo();
|
||||||
|
MachineFrameInfo *FFI = Fn.getFrameInfo();
|
||||||
|
|
||||||
unsigned MaxCallFrameSize = 0;
|
unsigned MaxCallFrameSize = 0;
|
||||||
bool HasCalls = false;
|
bool HasCalls = FFI->hasCalls();
|
||||||
|
|
||||||
// Get the function call frame set-up and tear-down instruction opcode
|
// Get the function call frame set-up and tear-down instruction opcode
|
||||||
int FrameSetupOpcode = RegInfo->getCallFrameSetupOpcode();
|
int FrameSetupOpcode = RegInfo->getCallFrameSetupOpcode();
|
||||||
@ -166,7 +167,6 @@ void PEI::calculateCallsInformation(MachineFunction &Fn) {
|
|||||||
HasCalls = true;
|
HasCalls = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineFrameInfo *FFI = Fn.getFrameInfo();
|
|
||||||
FFI->setHasCalls(HasCalls);
|
FFI->setHasCalls(HasCalls);
|
||||||
FFI->setMaxCallFrameSize(MaxCallFrameSize);
|
FFI->setMaxCallFrameSize(MaxCallFrameSize);
|
||||||
|
|
||||||
|
@ -4902,6 +4902,7 @@ static SDValue
|
|||||||
GetTLSADDR(SelectionDAG &DAG, SDValue Chain, GlobalAddressSDNode *GA,
|
GetTLSADDR(SelectionDAG &DAG, SDValue Chain, GlobalAddressSDNode *GA,
|
||||||
SDValue *InFlag, const EVT PtrVT, unsigned ReturnReg,
|
SDValue *InFlag, const EVT PtrVT, unsigned ReturnReg,
|
||||||
unsigned char OperandFlags) {
|
unsigned char OperandFlags) {
|
||||||
|
MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo();
|
||||||
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
|
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
|
||||||
DebugLoc dl = GA->getDebugLoc();
|
DebugLoc dl = GA->getDebugLoc();
|
||||||
SDValue TGA = DAG.getTargetGlobalAddress(GA->getGlobal(),
|
SDValue TGA = DAG.getTargetGlobalAddress(GA->getGlobal(),
|
||||||
@ -4915,6 +4916,10 @@ GetTLSADDR(SelectionDAG &DAG, SDValue Chain, GlobalAddressSDNode *GA,
|
|||||||
SDValue Ops[] = { Chain, TGA };
|
SDValue Ops[] = { Chain, TGA };
|
||||||
Chain = DAG.getNode(X86ISD::TLSADDR, dl, NodeTys, Ops, 2);
|
Chain = DAG.getNode(X86ISD::TLSADDR, dl, NodeTys, Ops, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TLSADDR will be codegen'ed as call. Inform MFI that function has calls.
|
||||||
|
MFI->setHasCalls(true);
|
||||||
|
|
||||||
SDValue Flag = Chain.getValue(1);
|
SDValue Flag = Chain.getValue(1);
|
||||||
return DAG.getCopyFromReg(Chain, dl, ReturnReg, PtrVT, Flag);
|
return DAG.getCopyFromReg(Chain, dl, ReturnReg, PtrVT, Flag);
|
||||||
}
|
}
|
||||||
|
63
test/CodeGen/X86/2009-12-11-TLSNoRedZone.ll
Normal file
63
test/CodeGen/X86/2009-12-11-TLSNoRedZone.ll
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
; RUN: llc -relocation-model=pic < %s | FileCheck %s
|
||||||
|
; PR5723
|
||||||
|
target datalayout = "e-p:64:64"
|
||||||
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
%0 = type { [1 x i64] }
|
||||||
|
%link = type { %0* }
|
||||||
|
%test = type { i32, %link }
|
||||||
|
|
||||||
|
@data = global [2 x i64] zeroinitializer, align 64 ; <[2 x i64]*> [#uses=1]
|
||||||
|
@ptr = linkonce thread_local global [1 x i64] [i64 ptrtoint ([2 x i64]* @data to i64)], align 64 ; <[1 x i64]*> [#uses=1]
|
||||||
|
@link_ptr = linkonce thread_local global [1 x i64] zeroinitializer, align 64 ; <[1 x i64]*> [#uses=1]
|
||||||
|
@_dm_my_pe = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
|
||||||
|
@_dm_pes_in_prog = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
|
||||||
|
@_dm_npes_div_mult = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
|
||||||
|
@_dm_npes_div_shift = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
|
||||||
|
@_dm_pe_addr_loc = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
|
||||||
|
@_dm_offset_addr_mask = external global [1 x i64], align 64 ; <[1 x i64]*> [#uses=0]
|
||||||
|
|
||||||
|
define void @leaf() nounwind {
|
||||||
|
; CHECK: leaf:
|
||||||
|
; CHECK-NOT: -8(%rsp)
|
||||||
|
; CHECK: leaq link_ptr@TLSGD
|
||||||
|
; CHECK: call __tls_get_addr@PLT
|
||||||
|
"file foo2.c, line 14, bb1":
|
||||||
|
%p = alloca %test*, align 8 ; <%test**> [#uses=4]
|
||||||
|
br label %"file foo2.c, line 14, bb2"
|
||||||
|
|
||||||
|
"file foo2.c, line 14, bb2": ; preds = %"file foo2.c, line 14, bb1"
|
||||||
|
br label %"@CFE_debug_label_0"
|
||||||
|
|
||||||
|
"@CFE_debug_label_0": ; preds = %"file foo2.c, line 14, bb2"
|
||||||
|
%r = load %test** bitcast ([1 x i64]* @ptr to %test**), align 8 ; <%test*> [#uses=1]
|
||||||
|
store %test* %r, %test** %p, align 8
|
||||||
|
br label %"@CFE_debug_label_2"
|
||||||
|
|
||||||
|
"@CFE_debug_label_2": ; preds = %"@CFE_debug_label_0"
|
||||||
|
%r1 = load %link** bitcast ([1 x i64]* @link_ptr to %link**), align 8 ; <%link*> [#uses=1]
|
||||||
|
%r2 = load %test** %p, align 8 ; <%test*> [#uses=1]
|
||||||
|
%r3 = ptrtoint %test* %r2 to i64 ; <i64> [#uses=1]
|
||||||
|
%r4 = inttoptr i64 %r3 to %link** ; <%link**> [#uses=1]
|
||||||
|
%r5 = getelementptr %link** %r4, i64 1 ; <%link**> [#uses=1]
|
||||||
|
store %link* %r1, %link** %r5, align 8
|
||||||
|
br label %"@CFE_debug_label_3"
|
||||||
|
|
||||||
|
"@CFE_debug_label_3": ; preds = %"@CFE_debug_label_2"
|
||||||
|
%r6 = load %test** %p, align 8 ; <%test*> [#uses=1]
|
||||||
|
%r7 = ptrtoint %test* %r6 to i64 ; <i64> [#uses=1]
|
||||||
|
%r8 = inttoptr i64 %r7 to %link* ; <%link*> [#uses=1]
|
||||||
|
%r9 = getelementptr %link* %r8, i64 1 ; <%link*> [#uses=1]
|
||||||
|
store %link* %r9, %link** bitcast ([1 x i64]* @link_ptr to %link**), align 8
|
||||||
|
br label %"@CFE_debug_label_4"
|
||||||
|
|
||||||
|
"@CFE_debug_label_4": ; preds = %"@CFE_debug_label_3"
|
||||||
|
%r10 = load %test** %p, align 8 ; <%test*> [#uses=1]
|
||||||
|
%r11 = ptrtoint %test* %r10 to i64 ; <i64> [#uses=1]
|
||||||
|
%r12 = inttoptr i64 %r11 to i32* ; <i32*> [#uses=1]
|
||||||
|
store i32 1, i32* %r12, align 4
|
||||||
|
br label %"@CFE_debug_label_5"
|
||||||
|
|
||||||
|
"@CFE_debug_label_5": ; preds = %"@CFE_debug_label_4"
|
||||||
|
ret void
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user