[LLVMdev] LLVM Newb: Getting started
Wolfgang Draxinger
wdraxinger at darkstargames.de
Sat Nov 25 03:24:42 PST 2006
Am Freitag, 24. November 2006 03:00 schrieb Reid Spencer:
> If you're making your own front end, you probably won't need it :)
Well, I wanted to play around with it, so see, how my older programs
perform with it.
So far I managed to get some programs running by folowing scheme:
for src in $infiles; do
llvm-gcc -o $src.bc -c $src ;
opt -f -o $src.bc.opt $src.bc ;
llc -f $src.bc.opt ;
gcc -c $src.bc.opt.s ;
done
gcc -o $name *.o
However until now I always had to compile the source file with the
main function directly with gcc, so that the __main function (to
initialize the globals and static constructors) gets created.
I did not manage to make llvm-gcc create __main.
> If you can create platform independent code from D, then you should
> be able to just use the LLVM bytecode representation.
D itself is platform independent, but since D is also aimed at system
programming it has an inline asembler. However one can supply
different kinds of assembler through conditional comilation, so the
following would be completely valid:
void foo(){
version(x86) {
asm {
/* x86 assembler */
}
} else version(llvm) {
asm {
/* llvm assembler */
}
} else {
/* plain D implementation */
}
}
<http://www.digitalmars.com/d/iasm.html>
<http://www.digitalmars.com/d/version.html>
Any ideas, how this could be integrated with LLVM? The IMHO most naive
approach would be to add labels where the asm begins and ends. Then
the plattform dependent assembler being parted from the code llvm
gets to see and being processed by an external assembler into object
code. Later in the process the linker then reinserts the assembler
object code.
--
Wolfgang Draxinger
lead programmer - DARKSTARgames
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20061125/23841fdc/attachment.sig>
More information about the llvm-dev
mailing list