Sparc back end fix

Hi everyone,

Following my earlier posting (http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-November/036292.html), I sent another message to the list, but it seems like it didn't get through :frowning: I managed to fix the problem in my earlier post and compile a cross-llvm-gcc. Then I discovered I was having problems with a setting a variable based on a ?: condition. Anyway, I've managed to track down the problem which was due to the conditional move not declaring its implicit use of the icc register in the back end. The following patch fixes this problem. A test case is also provided here too.

Cheers
Tim

sparc-cc.patch (2.44 KB)

test-if.c (306 Bytes)

test-if.sparc.bc (872 Bytes)

Hi Tim,

Thanks for the patch. I had a few questions though - just to make sure that I get the problem correctly. Currently, here is your flow, as I understand it :

        x86 llvm-gcc binary llc -march=sparc gcc cross/sparc
source ---------------------> .bc ------------------> .s -----------------> sparc executable.

Is this correct? Or did you manage to build the llvm-gcc source on a sparc machine?

Also, does your flow work correctly for programs with C++ constructs (take any standard benchmark...e.g. PARSEC's streamcluster.cpp as an example program)? The reason I am asking this is because I partly succeeded in building the llvm-gcc frontend on a SPARC machine..which works fine for C programs. However, programs which involve C++ constructs do not succeed. Although I am yet to figure out the reason, I wanted to know if you ran into similar problems.

Thanks.
Raghu.

Hi Raghu,

So, I managed to get a cross-llvm-gcc compiled. It runs on x86_64-linux and produces code for sparc-solaris. So my compilation flow is this:

cross-llvm-gcc (source -> .bc)
llc -march=sparc -mcpu=v9 (.bc -> .s)
cross-gcc (.s -> sparc binary)

I haven't yet tried to get c++ programs working. I'm trying to compile parsec but due to the ?: problem, failed at blackscholes. Now that this seems to work, I'm going to try all c programs before moving onto c++. I'll keep you posted if I have success or failure with these.

Cheers
Tim

Sounds good, I'm happy to apply it if you think it's the right patch. Please convert the testcase to filecheck style like test/CodeGen/SPARC/basictest.ll on mainline. Thanks!

-Chris