llvm-6502/include/llvm
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
..
ADT add support for the sparcv9-*-* target triple to turn on 2010-02-04 06:34:01 +00:00
Analysis Change the argument to getIntegerSCEV to be an int64_t, rather 2010-02-04 02:43:51 +00:00
Assembly
Bitcode Kill ModuleProvider and ghost linkage by inverting the relationship between 2010-01-27 20:34:15 +00:00
CodeGen Disable external stubs for X86-32 and X86-64 2010-02-04 19:56:59 +00:00
CompilerDriver
Config Reconfigure with autoconf-2.60, and fix autoconf.ac to work with that version. 2010-02-03 02:11:49 +00:00
ExecutionEngine Move --march, --mcpu, and --mattr from JIT/TargetSelect.cpp to lli.cpp. 2010-02-05 16:19:36 +00:00
MC MC: Change default comment column to 40 characters. 2010-02-05 07:32:18 +00:00
Support Add a new top-level MachO.h file for manifest constants, fixing 2010-02-02 19:38:14 +00:00
System Add llvm::Program::ChangeStderrToBinary(). 2010-01-28 06:42:08 +00:00
Target change addPassesToEmitFile to return true on failure instead of its input, 2010-02-03 05:55:08 +00:00
Transforms Teach SimplifyCFG about magic pointer constants. 2010-02-05 22:03:18 +00:00
AbstractTypeUser.h
Argument.h
Attributes.h Remove the InlineHint attribute. There are no current or planned 2010-01-15 21:36:30 +00:00
AutoUpgrade.h
BasicBlock.h
CallGraphSCCPass.h elimiante the dynamic_cast's from opt. 2010-01-22 06:03:06 +00:00
CallingConv.h
CMakeLists.txt
Constant.h eliminate a bunch of pointless LLVMContext arguments. 2010-02-01 20:48:08 +00:00
Constants.h Adding missing methods for creating Add, Mul, Neg and Sub with NUW. 2010-02-02 12:53:04 +00:00
DerivedTypes.h
Function.h back this out for now. Growing Function is not good. 2010-01-21 20:10:22 +00:00
GlobalAlias.h
GlobalValue.h Kill ModuleProvider and ghost linkage by inverting the relationship between 2010-01-27 20:34:15 +00:00
GlobalVariable.h
GVMaterializer.h Kill ModuleProvider and ghost linkage by inverting the relationship between 2010-01-27 20:34:15 +00:00
InlineAsm.h
InstrTypes.h Adding missing methods for creating Add, Mul, Neg and Sub with NUW. 2010-02-02 12:53:04 +00:00
Instruction.def
Instruction.h
Instructions.h
IntrinsicInst.h Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast). 2010-01-15 19:04:09 +00:00
Intrinsics.h
Intrinsics.td Update of 94055 to track the IR level call site information via an intrinsic. 2010-01-28 01:45:32 +00:00
IntrinsicsAlpha.td
IntrinsicsARM.td
IntrinsicsCellSPU.td
IntrinsicsPowerPC.td
IntrinsicsX86.td
IntrinsicsXCore.td
LinkAllPasses.h
LinkAllVMCore.h fix a warning. 2010-01-16 21:55:24 +00:00
Linker.h
LLVMContext.h
Metadata.h Add MDNode::getIfExists(), an efficient way to determine if a value is used by metadata (since metadata does not appear in a value's use list) 2010-01-26 02:36:35 +00:00
Module.h Kill ModuleProvider and ghost linkage by inverting the relationship between 2010-01-27 20:34:15 +00:00
OperandTraits.h
Operator.h
Pass.h elimiante the dynamic_cast's from opt. 2010-01-22 06:03:06 +00:00
PassAnalysisSupport.h eliminate dynamic_cast from the pass manager. 2010-01-21 02:07:07 +00:00
PassManager.h Kill ModuleProvider and ghost linkage by inverting the relationship between 2010-01-27 20:34:15 +00:00
PassManagers.h eliminate a bunch of dynamic_cast's. 2010-01-22 05:24:46 +00:00
PassSupport.h add a helper method. 2010-01-20 19:25:45 +00:00
SymbolTableListTraits.h
Type.h
TypeSymbolTable.h
Use.h
User.h
Value.h Change Value::getUnderlyingObject to have the MaxLookup value specified as a 2010-01-25 18:26:54 +00:00
ValueSymbolTable.h Before existing NamedMDNode entry in the symbol table, remove any existing entry with the same name. 2010-01-26 22:03:41 +00:00