sparse, llvm: if-else code generation
commitf0f961f3a2d84c368aefadd8e5fc20036bfd110e
authorJeff Garzik <jeff@garzik.org>
Sat, 27 Aug 2011 07:55:04 +0000 (27 10:55 +0300)
committerPekka Enberg <penberg@kernel.org>
Sat, 27 Aug 2011 08:00:46 +0000 (27 11:00 +0300)
tree9b05e5df4d74852cbbcdc6f1ee0f5e3c536c9afb
parent6071a81229aee0c44028e379edbe6f7f0e55c6cc
sparse, llvm: if-else code generation

It gets the code a bit farther, with the following test case:

int foo(int x)
{
        if (x > 0xffff)
                x++;
        else
                x--;
        return x;
}

* run with

        ./sparse-llvm hello.c | llvm-dis

for an IMO more useful disassembly than via 'llc'

* add 'priv' to struct basic_block

* run a first pass through the BB's, creating LLVMBasicBlockRef's and assigning
  them to bb->priv

* comment out unssa() call, and implement OP_PHI and OP_PHISOURCE, which LLVM
  directly supports.

* remove '%' prefix from PSEUDO_REG names, as it was redundant and made
  llvm-dis output ugly

* implement support for conditional and unconditional branches (OP_BR)

* implement OP_COPY.  a possibly better implementation would be a single-source
  LLVMBuildPhi

[ penberg@kernel.org: minor cleanups ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
linearize.h
sparse-llvm.c