Assembly Mips from bitecode llvm

Hi,
I’m trying to compile the benchmarks from Mibench suite with the application of the all LLVM’s tranformation passes.
Moreover, I’m trying to generate assembly code for Mips architecture for extraction of energy and performance metrics.
For this, for example, initially I compile the sources and link them generating a bitecode file. After, I apply each optimization using opt tool:
opt -$i file.bc -o file.opt.bc
where $i is each one of the LLVM’s tranformation pass.

After, to generate assembly MIPS, I do:
llc -march=mipsel file.opt.bc -o file.opt.s

I configured the LLVM with --build=mipsel, mips and --enable-targets=mipsel, mips

For some benchmarks from Mibench, this process worked, but for others it doesn’t worked.
For example: BITCOUNT, BLOWFISH, QSORT, DIJKSTRA, PATRICIA - (OK)
SUSAN and BASICMATH ( Not OK)

The output generated with BASICMATH and SUSAN CORNERS with llc was:

llc 0x08a35738
Stack dump:
0. Program arguments: llc -march=mipsel basicmath.strip.bc -o basicmath.strip.s

  1. Running pass ‘Function Pass Manager’ on module ‘basicmath.strip.bc’.
  2. Running pass ‘MIPS DAG->DAG Pattern Instruction Selection’ on function ‘@SolveCubic

How can I resolve this problem?

Am I performing the process of wrong way?

Thanks!

Hello

For this, for example, initially I compile the sources

How have you made this step?

For compile and link Basicmath files (using shell script):

llvm-gcc -emit-llvm basicmath_small.c -c -o basicmath_small.bc
llvm-gcc -emit-llvm cubic.c -c -o cubic.bc
llvm-gcc -emit-llvm isqrt.c -c -o isqrt.bc
llvm-gcc -emit-llvm rad2deg.c -c -o rad2deg.bc
llvm-link basicmath_small.bc cubic.bc isqrt.bc rad2deg.bc -o basicmath.bc

otms=“disable-opt#adce#always-inline#argpromotion#block-placement#…”
IFS=#
for i in $otms
do
printf "\n$i ::::::: "
opt -$i basicmath.bc -o basicmath.$i.bc
llc -march=mipsel basicmath.$i.bc -o basicmath.$i.s
done

Ok. And what does llvm-gcc --version show?

llvm-gcc (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2.9)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

llc --version:

Low Level Virtual Machine (http://llvm.org/):
llvm version 2.9
Optimized build.
Built Mar 5 2012 (20:21:19).
Host: x86_64-unknown-linux-gnu
Host CPU: i686

Registered Targets:
alpha - Alpha [experimental]
arm - ARM
bfin - Analog Devices Blackfin [experimental]
c - C backend
cellspu - STI CBEA Cell SPU [experimental]
cpp - C++ backend
mblaze - MBlaze
mips - Mips
mipsel - Mipsel
msp430 - MSP430 [experimental]
ppc32 - PowerPC 32
ppc64 - PowerPC 64
ptx - PTX
sparc - Sparc
sparcv9 - Sparc V9
systemz - SystemZ
thumb - Thumb
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
xcore - XCore

llvm-gcc (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2.9)
Copyright (C) 2007 Free Software Foundation, Inc.

Here I assume that your llvm-gcc is for x86-64-linux, since there was
no MIPS release.
So, you're feeding x86-oriented IR to MIPS backend. This won't work,
you will need to provide MIPS-aware IR.

Also, in 2.9 the MIPS was definitely not so mature. Hopefully MIPS
folks can comment on this.

Can you use clang?
llvm-gcc has been deprecated and it generates incorrect bitcode for mips.

The benchmark programs you are running, including the ones that
failed, are in the llvm test-suite,
and they are all passing on my local machine. I think they should
compile if you switch to using ToT clang & llvm.