llvm-6502/lib/Transforms
Erik Eckstein 72a1394991 Optimize switch lookup tables with linear mapping.
This is a simple optimization for switch table lookup:
It computes the output value directly with an (optional) mul and add if there is a linear mapping between index and output.
Example:

int f1(int x) {
  switch (x) {
    case 0: return 10;
    case 1: return 11;
    case 2: return 12;
    case 3: return 13;
  }
  return 0;
}

generates:

define i32 @f1(i32 %x) #0 {
entry:
  %0 = icmp ult i32 %x, 4
  br i1 %0, label %switch.lookup, label %return

switch.lookup:
  %switch.offset = add i32 %x, 10
  ret i32 %switch.offset

return:
  ret i32 0
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222121 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 09:13:57 +00:00
..
Hello [CMake] Add LLVM_LINK_COMPONENTS to loadable modules, LLVMHello and BugpointPasses, on Win32. 2014-07-13 13:36:48 +00:00
InstCombine InstCombine: Fix infinite loop caused by visitFPTrunc 2014-11-14 21:21:15 +00:00
Instrumentation Fix 80 cols caught by the linter... 2014-11-14 00:41:42 +00:00
IPO Reformat partially, where I touched for whitespace changes. 2014-10-28 11:54:52 +00:00
ObjCARC Add back r222061 with a fix. 2014-11-17 02:28:27 +00:00
Scalar Reapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed loads before 2014-11-14 21:09:13 +00:00
Utils Optimize switch lookup tables with linear mapping. 2014-11-17 09:13:57 +00:00
Vectorize IR: Make MDString::getName() private 2014-11-13 23:59:16 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile