Skip to content

In Which I Contemplate Cloning a LEG

November 16, 2014

I can now successfully build llvm for the “LEG” architecture per the tutorial. To make some progress from here I could either try to modify the LEG target or clone it and modify the clone. I’d also like to start working in Xcode rather than the command line and Unix Makefiles. I have nothing against make but I like the idea of Xcode being able to find definitions and declarations in the dozens of source files.

So, I have:

  • Made a copy of the llvmleg34wclang/llvm-leg-leg_for_release_34 directory structure and called it llvmcosmac/llvmlegcos.
  • Wiped out the contents of the llvmcosmac/llvmlegcos/build folder
  • in the build folder, run cmake -G “Xcode” -DCMAKE_BUILD_TYPE:STRING=DEBUG -DLLVM_TARGETS_TO_BUILD:STRING=”LEG;ARM” ../llvmlegcos
  • started Xcode and opened the project LLVM.xcodeproj

At the moment Xcode seems to be chundering away at opening the file – it’s been a good 10+ minutes.  I’ll probably go off and do something different for a while.  Lord knows how long the build will run.

Update: After about 1/2 hour Xcode has finished chundering and will reluctantly open a window.  It’s painfully slow though.  I think it’s just too much for this underpowered macbook.

The actual build under Xcode took about 3 hours!  Total time from Cmake thru being able to test the result was about 5 hours.  Say 1 hour for Xcode to open the project the first time then 3 hours for the build with an hour lost to me not starting the next thing right away.  I know that sounds crazy but it may not be a show-stopper – it depends on how long a build takes if i make a simple change.  I’ll try that today.  It does mean that I won’t be doing this again to clone LEG changing all LEG to COSMAC – just too painful.  So I’ll be LEGging it from here out – just changing things under the covers but not the file or data names.

Two things – it would only cost me $60 bucks to put more memory on the poor little macbook.  I’ve held off because I want a new one for Christmas but it would probably make a huge difference; Also, since I’ve gone back to LLVM 3.4.2 and I don’t need C++11 I could probably compile with Microsoft Visual C++ 2010 which would let me use the windows box I use for LCC1802 which has gobs of memory and a solid state disk.

Anyway, for now, here’s the output of a C compile:


bill-rowes-MacBook:llvmcosmac billrowe$ ./build/bin/debug/clang -cc1 -triple leg-unknown-unknown -S -O3 -o ex1.s llvmlegcos/docs/Codeplay/examples/ex1/ex1.c
bill-rowes-MacBook:llvmcosmac billrowe$ cat ex1.s
	.file	"llvmlegcos/docs/Codeplay/examples/ex1/ex1.c"
	.text
	.globl	foo
	.type	foo,@function
foo:
	add r0, r1, r0
	bx lr
.tmp0:
	.size	foo, .tmp0-foo


	.ident	"clang version 3.4.2 "
Advertisements

From → LLVM

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: