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 Use MemoryBuffer::getBufferIdentifier() in the AsmPrinter instead 2009-09-08 22:20:35 +00:00
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 Add a 'set_option' action for use in OptionPreprocessor. 2009-12-17 07:49:16 +00:00
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 When a constant's type is refined, update the constant in place 2009-09-15 15:58:07 +00:00
Argument.h sink twine.h down out of Value.h. It is annoying that you need 2009-12-29 07:12:03 +00:00
Attributes.h Remove the InlineHint attribute. There are no current or planned 2010-01-15 21:36:30 +00:00
AutoUpgrade.h Reapply 79977. 2009-08-28 23:24:31 +00:00
BasicBlock.h sink twine.h down out of Value.h. It is annoying that you need 2009-12-29 07:12:03 +00:00
CallGraphSCCPass.h elimiante the dynamic_cast's from opt. 2010-01-22 06:03:06 +00:00
CallingConv.h Add MSP430 interrupt calling conv. No functionality change yet. 2009-12-07 02:27:35 +00:00
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 This fixes a memory leak in OpaqueType found by Google's internal heapchecker. 2009-12-17 19:55:06 +00:00
Function.h back this out for now. Growing Function is not good. 2010-01-21 20:10:22 +00:00
GlobalAlias.h sink twine.h down out of Value.h. It is annoying that you need 2009-12-29 07:12:03 +00:00
GlobalValue.h Kill ModuleProvider and ghost linkage by inverting the relationship between 2010-01-27 20:34:15 +00:00
GlobalVariable.h sink twine.h down out of Value.h. It is annoying that you need 2009-12-29 07:12:03 +00:00
GVMaterializer.h Kill ModuleProvider and ghost linkage by inverting the relationship between 2010-01-27 20:34:15 +00:00
InlineAsm.h Pass StringRef by value. 2009-11-06 10:58:06 +00:00
InstrTypes.h Adding missing methods for creating Add, Mul, Neg and Sub with NUW. 2010-02-02 12:53:04 +00:00
Instruction.def rename indbr -> indirectbr to appease the residents of #llvm. 2009-10-28 00:19:10 +00:00
Instruction.h Final step in the metadata API restructuring: move the 2009-12-29 09:01:33 +00:00
Instructions.h sink the Instruction::HasMetadata bit into SubclassData. 2009-12-29 02:46:09 +00:00
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 Make LLVMContext and LLVMContextImpl classes instead of structs. 2009-08-11 17:45:13 +00:00
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 Add new intrinsics for Neon vldN_lane and vstN_lane operations. 2009-08-22 02:28:46 +00:00
IntrinsicsCellSPU.td
IntrinsicsPowerPC.td
IntrinsicsX86.td Revert r92939. These intrinsics get matched to LLVM instructions, 2010-01-07 21:43:58 +00:00
IntrinsicsXCore.td
LinkAllPasses.h remove the random sampling framework, which is not maintained anymore. 2010-01-02 20:07:03 +00:00
LinkAllVMCore.h fix a warning. 2010-01-16 21:55:24 +00:00
Linker.h Pass StringRef by value. 2009-11-06 10:58:06 +00:00
LLVMContext.h Final step in the metadata API restructuring: move the 2009-12-29 09:01:33 +00:00
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 Public and private corrections, warned about by icc (#304). 2009-09-06 08:55:57 +00:00
Operator.h Remove a bunch of unused arguments from functions, silencing a 2009-10-14 20:28:33 +00:00
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 Forward-declare ValueSymbolTable so that SymbolTableListTraits.h can be parsed by itself 2009-09-30 00:08:25 +00:00
Type.h Add a new predicate for integer type equality tests. 2010-01-05 20:04:48 +00:00
TypeSymbolTable.h Pass StringRef by value. 2009-11-06 10:58:06 +00:00
Use.h eliminate all 80-col violations that I have introduced in my recent checkins (and some others more) 2009-08-27 23:44:33 +00:00
User.h Remove some dead functions, patch by Ryan Flynn! 2009-07-14 18:58:35 +00:00
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