llvm-6502/lib
Chris Lattner 542f149f00 Implement switch->br and br->switch folding by ripping out the switch->switch
and br->br code and generalizing it.  This allows us to compile code like this:

int test(Instruction *I) {
  if (isa<CastInst>(I))
    return foo(7);
  else if (isa<BranchInst>(I))
    return foo(123);
  else if (isa<UnwindInst>(I))
    return foo(1241);
  else if (isa<SetCondInst>(I))
    return foo(1);
  else if (isa<VAArgInst>(I))
    return foo(42);
  return foo(-1);
}

into:

int %_Z4testPN4llvm11InstructionE("struct.llvm::Instruction"* %I) {
entry:
        %tmp.1.i.i.i.i.i.i.i = getelementptr "struct.llvm::Instruction"* %I, long 0, ubyte 4            ; <uint*> [#uses=1]
        %tmp.2.i.i.i.i.i.i.i = load uint* %tmp.1.i.i.i.i.i.i.i          ; <uint> [#uses=2]
        %tmp.2.i.i.i.i.i.i = seteq uint %tmp.2.i.i.i.i.i.i.i, 27                ; <bool> [#uses=0]
        switch uint %tmp.2.i.i.i.i.i.i.i, label %endif.0 [
                 uint 27, label %then.0
                 uint 2, label %then.1
                 uint 5, label %then.2
                 uint 14, label %then.3
                 uint 15, label %then.3
                 uint 16, label %then.3
                 uint 17, label %then.3
                 uint 18, label %then.3
                 uint 19, label %then.3
                 uint 32, label %then.4
        ]
...

As well as handling the cases in 176.gcc and many other programs more effectively.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11964 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 21:28:10 +00:00
..
Analysis Only clone global nodes between graphs if both graphs have the global. 2004-02-27 20:05:15 +00:00
Archive
AsmParser
Bytecode
CodeGen Rename member function to be consistent with the rest. 2004-02-27 06:11:15 +00:00
Debugger
ExecutionEngine remove obsolete comment 2004-02-26 07:59:22 +00:00
Linker Include Config/config.h for SHLIBEXT. 2004-02-23 22:42:51 +00:00
Support Make sure that at least one virtual method is defined in a .cpp file to avoid 2004-02-26 07:24:18 +00:00
Target Change this so that LLC actually tries to run the code generator, though it will 2004-02-28 20:21:45 +00:00
Transforms Implement switch->br and br->switch folding by ripping out the switch->switch 2004-02-28 21:28:10 +00:00
VMCore Fix Regression/Assembler/2004-02-27-SelfUseAssertError.ll 2004-02-27 17:28:25 +00:00
Makefile