aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-28 21:28:10 +0000
committerChris Lattner <sabre@nondot.org>2004-02-28 21:28:10 +0000
commitd3e6ae263caeedfa4ca6dac1a4781ace2853038a (patch)
tree8dfb274359ff47a82b18b6054d8ec8697cc7aa2c /llvm/lib/CodeGen/MachineInstr.cpp
parent72bb8fcb1530215702cea5da710e0cc43a2e2fd4 (diff)
downloadllvm-d3e6ae263caeedfa4ca6dac1a4781ace2853038a.zip
llvm-d3e6ae263caeedfa4ca6dac1a4781ace2853038a.tar.gz
llvm-d3e6ae263caeedfa4ca6dac1a4781ace2853038a.tar.bz2
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. llvm-svn: 11964
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
0 files changed, 0 insertions, 0 deletions