Druntime DMD/LDC/GDC architecture

Kai Nacke via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 24 03:32:59 PDT 2014


On Monday, 23 June 2014 at 18:09:46 UTC, Ilya Yaroshenko wrote:
> Hello all!
>
> very simple code:
>
> ------------------
> double[] a, c;
> ...
> c[] += a[];
> ------------------
>
> The DMD version I can find in _arraySliceSliceAddass_d, 
> https://github.com/D-Programming-Language/druntime/blob/master/src/rt/arraydouble.d 
> .
>
> What about LDC and GDC?
> The _arraySliceSliceAddass_d is the same, no any version(LDC).
>
> When I compile code into assembler I found other code then in 
> asm scope.
>
> So I suppose LDC has it's own architecture.
> Is it right?
>
> Where I can find it for understanding what optimization can be 
> done by LLVM optimizer?
>
> Have GDC it's own architecture too?
>
> Best Regards,
> Ilya

Hi Ilya,

I am not sure if I understand your question. I compiled this code 
with ldc

void main()
{
     double[] a, c;

     a[] = 1;
     c[] = 2;
     c[] += a[];
}

(options ldc2 -c -output-ll -output-s -release -O0)

and get in the main function

	movq	120(%rsp), %r8
	movq	128(%rsp), %r9
	movq	104(%rsp), %rcx
	movq	112(%rsp), %rdx
	callq	_arraySliceSliceAddass_d

Using -O1 or higher optimizes the call away, maybe that is the 
problem. Could you post the source code you are using?

Regards,
Kai


More information about the Digitalmars-d mailing list