Hope d has great development in Raspberry Pi

Dan Olson via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Sun Jan 31 14:17:43 PST 2016


Dan Olson <gorox at comcast.net> writes:
> Ironically, Fibers do work with optimize compile.  Something does wrong
> with -O0, some bad codegen in spots.
>
> Simple phobos hello world works, just make sure you give -O to enable
> optimizer.

Picking away at LDC on arm-linux.

I am assuming that very few folks are trying LDC with target
arm-unknown-linux-gnueabihf because LLVM really has a problem with
simple global variables (__gshared).  It is not LDC, but LLVM.  The
codegen to load a simple global variable is all wrong with optimizer
disabled (-O0).

// load x into a register

	ldr	r0, .LCPI0_0
	ldr	r0, [r0]
	ldr	r0, [r0]        // what?! an extra load? SEGV!

// elsewhere, x is defined as
x:
	.long	0
.LCPI0_0:
	.long	x


Clang is ok at -O0.  But if I take clang IR output (-emit-llvm) and
generate code with llc -O0, it too has extra ldr instruction.  Clang
must be adding some optimization passes at -O0 that are different than
llc -O0.  I think LDC uses same passes as llc, so there is the problem.

Next, see if LLVM has a bug filed for this and find that extra
optimization pass for LDC.
-- 
Dan


More information about the digitalmars-d-ldc mailing list