[fpc-devel] Bad code generation on linux x86_64

C Western l at c-m-w.me.uk
Sun May 21 13:21:25 CEST 2017


On 21/05/17 11:56, Florian Klämpfl wrote:
> Am 21.05.2017 um 11:23 schrieb C Western:
>> On 21/05/17 08:45, Florian Klämpfl wrote:
>>> Am 20.05.2017 um 10:50 schrieb C Western:
>>>> The following revision seems to be generating bad code for me on linux/x86_64:
>>>
>>> Can you please change line 26 in fpc compiler/x86/aoptx86.pas from
>>> { $define DEBUG_AOPTCPU}
>>> to
>>> {$define DEBUG_AOPTCPU}
>>>
>>> and post the assembler output again?
>>
>> See below.
> 
> Thanks. Last request ;): please send me the same output but compile additionally with -Oonopeephole

This code doesn't crash:

.section .text.n_logunit$_$tlogform_$__$$_formcreate$tobject
	.balign 16,0x90
.globl	LOGUNIT$_$TLOGFORM_$__$$_FORMCREATE$TOBJECT
	.type	LOGUNIT$_$TLOGFORM_$__$$_FORMCREATE$TOBJECT, at function
LOGUNIT$_$TLOGFORM_$__$$_FORMCREATE$TOBJECT:
.Lc1:
	# Register rsp allocated
.Ll1:
# [LogUnit.pas]
# [95] begin
	pushq	%rbx
	pushq	%r12
	pushq	%r13
	pushq	%r14
	pushq	%r15
.Lc3:
	# Register rdi,rsi,rax allocated
	movq	%rdi,%rax
	# Register rdi released
# Var $self located in register rax
	# Register rsi released
# Var Sender located in register rsi
	# Register r15 allocated
.Ll2:
# [96] DragAcceptFiles(Self, True);
	movq	%rax,%r15
	# Register rax released
# Var $self located in register r15
	# Register rdi allocated
	movq	%r15,%rdi
	# Register sil allocated
	movb	$1,%sil
	# Register rax,rcx,rdx,rsi,rdi,r8,r9,r10,r11 allocated
	call	WCOMPAT_$$_DRAGACCEPTFILES$TCUSTOMFORM$BOOLEAN at PLT
	# Register rcx,rdx,rsi,rdi,r8,r9,r10,r11 released
	# Register rax allocated
.Ll3:
# [98] OnDropFiles := @FormDropFiles;
	movq 
LOGUNIT$_$TLOGFORM_$__$$_FORMDROPFILES$TOBJECT$array_of_ANSISTRING at GOTPCREL(%rip),%rax
	movq	%rax,1736(%r15)
	# Register rax released
	movq	%r15,1744(%r15)
	# Register rax,rcx,rdx,rsi,rdi,r8,r9,r10,r11 allocated
.Ll4:
# [100] 
GlobalMixture.GetEnumNames(GlobalMixture.IndexOfSetting('PrintLevel'),OutputComboBox.Items);
	call	GLOBAL_$$_GLOBALMIXTURE$$TMIXTURE at PLT
	# Register rcx,rdx,rsi,rdi,r8,r9,r10,r11 released
	# Register r13 allocated
	movq	%rax,%r13
	# Register rax released
	# Register rax,rcx,rdx,rsi,rdi,r8,r9,r10,r11 allocated
	call	GLOBAL_$$_GLOBALMIXTURE$$TMIXTURE at PLT
	# Register rcx,rdx,rsi,r8,r9,r10,r11 released
	# Register rdi allocated
	movq	%rax,%rdi
	# Register rax released
	# Register rsi allocated
	leaq	.Ld2(%rip),%rsi
	# Register rax,rcx,rdx,rsi,rdi,r8,r9,r10,r11 allocated
	call	MNODE$_$TMNODE_$__$$_INDEXOFSETTING$ANSISTRING$$LONGINT at PLT
	# Register rcx,rdx,rsi,rdi,r8,r9,r10,r11 released
	# Register r12d allocated
	movl	%eax,%r12d
	# Register eax released
	# Register rax allocated
	movq	2048(%r15),%rax
	# Register rbx allocated
	movq	1424(%rax),%rbx
	# Register rax released
	# Register rax allocated
	movq	%r13,%rax
	# Register r13 released
	# Register r13 allocated
	movq	%rax,%r13
	# Register r14 allocated
	movq	%rax,%r14
	# Register rax released
	testq	%r14,%r14
	je	.Lj5
	# Register rflags released
	jmp	.Lj6
.Lj5:
	# Register rax,rcx,rdx,rsi,rdi,r8,r9,r10,r11 allocated
	call	fpc_objecterror at PLT
	# Register rax,rcx,rdx,rsi,rdi,r8,r9,r10,r11 released
.Lj6:
	# Register rax allocated
	movq	(%r14),%rax
	# Register r14 released
	# Register r14 allocated
	movq	%rax,%r14
	# Register rax released
	# Register rdi allocated
	movq	%r14,%rdi
	# Register rax,rcx,rdx,rsi,rdi,r8,r9,r10,r11 allocated
	call	fpc_check_object at PLT
	# Register rax,rcx,rdx,rsi,r8,r9,r10,r11 released
	# Register rdi allocated
	movq	%r13,%rdi
	# Register r13 released
	# Register rdx allocated
	movq	%rbx,%rdx
	# Register rbx released
	# Register esi allocated
	movl	%r12d,%esi
	# Register rax,rcx,rdx,rsi,rdi,r8,r9,r10,r11 allocated
	call	*744(%r14)
	# Register rax,rcx,rdx,rsi,rdi,r8,r9,r10,r11 allocated
.Ll5:




More information about the fpc-devel mailing list