llvm-6502/lib
Jakob Stoklund Olesen 58e9ee85fd Teach SimplifyCFG about magic pointer constants.
Weird code sometimes uses pointer constants other than null. This patch
teaches SimplifyCFG to build switch instructions in those cases.

Code like this:

void f(const char *x) {
  if (!x)
    puts("null");
  else if ((uintptr_t)x == 1)
    puts("one");
  else if (x == (char*)2 || x == (char*)3)
    puts("two");
  else if ((intptr_t)x == 4)
    puts("four");
  else
    puts(x);
}

Now becomes a switch:

define void @f(i8* %x) nounwind ssp {
entry:
  %magicptr23 = ptrtoint i8* %x to i64            ; <i64> [#uses=1]
  switch i64 %magicptr23, label %if.else16 [
    i64 0, label %if.then
    i64 1, label %if.then2
    i64 2, label %if.then9
    i64 3, label %if.then9
    i64 4, label %if.then14
  ]

Note that LLVM's own DenseMap uses magic pointers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95439 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 22:03:18 +00:00
..
Analysis Change the argument to getIntegerSCEV to be an int64_t, rather 2010-02-04 02:43:51 +00:00
Archive From PR6228: 2010-02-04 06:19:43 +00:00
AsmParser Kill ModuleProvider and ghost linkage by inverting the relationship between 2010-01-27 20:34:15 +00:00
Bitcode Fix (and test) function-local metadata that occurs before the instruction that it refers to; fix is to not enumerate operands of function-local metadata until after all instructions have been enumerated 2010-02-04 01:13:08 +00:00
CodeGen When the scheduler unfold a load folding instruction it move some of the predecessors to the unfolded load. It decides what gets moved to the load by checking whether the new load is using the predecessor as an operand. The check neglects the cases whether the predecessor is a flagged scheduling unit. 2010-02-05 01:27:11 +00:00
CompilerDriver Better error message. 2010-01-26 14:55:16 +00:00
ExecutionEngine Move --march, --mcpu, and --mattr from JIT/TargetSelect.cpp to lli.cpp. 2010-02-05 16:19:36 +00:00
Linker Need to recurse for all operands of function-local metadata; and handle Instructions (which map to themselves) 2010-01-27 22:03:03 +00:00
MC MC: Change default comment column to 40 characters. 2010-02-05 07:32:18 +00:00
Support add support for the sparcv9-*-* target triple to turn on 2010-02-04 06:34:01 +00:00
System Add llvm::Program::ChangeStderrToBinary(). 2010-01-28 06:42:08 +00:00
Target wire up 64-bit MCCodeEmitter. 2010-02-05 21:51:35 +00:00
Transforms Teach SimplifyCFG about magic pointer constants. 2010-02-05 22:03:18 +00:00
VMCore Adding missing methods for creating Add, Mul, Neg and Sub with NUW. 2010-02-02 12:53:04 +00:00
Makefile