Bruno Filipe | 21 Oct 22:43 2012
Picon

Need help trying to generate mblaze code.

Hello,


this is a very dump question, I hope to do more valuable question soon, but for now I'm just trying to run a simple hello world in C for clang and llvm  to the target mblaze, but is not working.

( I need to change the compiler in the next stage)

I past all the weekend tried to run this, and I was unable, I did the build of llVM/clang, but no bin was generate, only silly folder that I don't know for what can be useful.   

Can you please recommend me some tutorials or explain what I need to do run to generate a code to mblaze from a .c file using LLVM ?  this is been a very frustrating  experience because of the lack of experience and information. This appears to be so basic that there is no tutorial available. 

tks in advance

best regards. 
_______________________________________________
LLVM Developers mailing list
LLVMdev <at> cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Dmitry N. Mikushin | 21 Oct 23:06 2012
Picon

Re: Need help trying to generate mblaze code.

Hi Bruno,

$ clang -emit-llvm -S -c test.c -o - | opt -O3 | ./llc -march=mblaze -o -

The piped command above first emits LLVM IR using clang frontend, then
optimizes IR with -O3 level, and then codegens IR using mblaze
backend.

I used the following code:

$ cat test.c
#include <stdio.h>

int main(int argc, char* argv[])
{
	printf("Hello, world!\n");
	return 0;
}

$ clang -emit-llvm -S -c test.c -o - | opt -O3 | ./llc -march=mblaze -o -
	.file	"<stdin>"
	.text
	.globl	main
	.align	2
	.type	main, <at> function
	.ent	main                    #  <at> main
main:
	.frame	r1,4,r15
	.mask	0x8000
# BB#0:                                 # %entry
	addik     r1, r1, -4
	swi       r15, r1, 0
	ori       r5, r0, ($str)
	brlid     r15, puts
	nop
	addk      r3, r0, r0
	lwi       r15, r1, 0
	rtsd      r15, 8
	addik     r1, r1, 4
	.end	main
$tmp0:
	.size	main, ($tmp0)-main

	.type	$str, <at> object            #  <at> str
	.section	.rodata.str1.1,"aMS", <at> progbits,1
$str:
	.asciz	 "Hello, world!"
	.size	$str, 14

Is it what you want to get?
- D.

2012/10/21 Bruno Filipe <b.filipe <at> gmail.com>:
> Hello,
>
> this is a very dump question, I hope to do more valuable question soon, but
> for now I'm just trying to run a simple hello world in C for clang and llvm
> to the target mblaze, but is not working.
>
> ( I need to change the compiler in the next stage)
>
> I past all the weekend tried to run this, and I was unable, I did the build
> of llVM/clang, but no bin was generate, only silly folder that I don't know
> for what can be useful.
>
> Can you please recommend me some tutorials or explain what I need to do run
> to generate a code to mblaze from a .c file using LLVM ?  this is been a
> very frustrating  experience because of the lack of experience and
> information. This appears to be so basic that there is no tutorial
> available.
>
> tks in advance
>
> best regards.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev <at> cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
Renato Golin | 21 Oct 23:06 2012

Re: Need help trying to generate mblaze code.

On 21 October 2012 21:43, Bruno Filipe <b.filipe <at> gmail.com> wrote:
> I past all the weekend tried to run this, and I was unable, I did the build
> of llVM/clang, but no bin was generate, only silly folder that I don't know
> for what can be useful.

Hi Bruno,

MBlaze is enabled by default if you just build LLVM+Clang, and if you
don't see a bin directory under your build directory, you probably
haven't managed to compile it correctly.

The default page for building LLVM+Clang is:

http://llvm.org/docs/GettingStarted.html

Basically, checkout (svn or git) and "make" should do the trick. There
should be a bin dir where you built it.

You can "sudo make install" if you want those binaries to be your
default LLVM (if you don't have packages installed, that is).

Also, I'm assuming Linux here... if you have Windows or Mac, other
people can advise, as I have no idea... ;)

--

-- 
cheers,
--renato

http://systemcall.org/

Gmane