[LLVMdev] Need help trying to generate mblaze code.

Dmitry N. Mikushin maemarcus at gmail.com
Sun Oct 21 14:06:25 PDT 2012

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

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>"
	.globl	main
	.align	2
	.type	main, at function
	.ent	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
	addk      r3, r0, r0
	lwi       r15, r1, 0
	rtsd      r15, 8
	addik     r1, r1, 4
	.end	main
	.size	main, ($tmp0)-main

	.type	$str, at object            # @str
	.section	.rodata.str1.1,"aMS", at progbits,1
	.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

More information about the llvm-dev mailing list