llvm-6502/include/llvm
Chandler Carruth ed90ed077a Add a new visitor for walking the uses of a pointer value.
This visitor provides infrastructure for recursively traversing the
use-graph of a pointer-producing instruction like an alloca or a malloc.
It maintains a worklist of uses to visit, so it can handle very deep
recursions. It automatically looks through instructions which simply
translate one pointer to another (bitcasts and GEPs). It tracks the
offset relative to the original pointer as long as that offset remains
constant and exposes it during the visit as an APInt offset. Finally, it
performs conservative escape analysis.

However, currently it has some limitations that should be addressed
going forward:
1) It doesn't handle vectors of pointers.
2) It doesn't provide a cheaper visitor when the constant offset
   tracking isn't needed.
3) It doesn't support non-instruction pointer values.

The current functionality is exactly what is required to implement the
SROA pointer-use visitors in terms of this one, rather than in terms of
their own ad-hoc base visitor, which was always very poorly specified.
SROA has been converted to use this, and the code there deleted which
this utility now provides.

Technically speaking, using this new visitor allows SROA to handle a few
more cases than it previously did. It is now more aggressive in ignoring
chains of instructions which look like they would defeat SROA, but in
fact do not because they never result in a read or write of memory.
While this is "neat", it shouldn't be interesting for real programs as
any such chains should have been removed by others passes long before we
get to SROA. As a consequence, I've not added any tests for these
features -- it shouldn't be part of SROA's contract to perform such
heroics.

The goal is to extend the functionality of this visitor going forward,
and re-use it from passes like ASan that can benefit from doing
a detailed walk of the uses of a pointer.

Thanks to Ben Kramer for the code review rounds and lots of help
reviewing and debugging this patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169728 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-10 08:28:39 +00:00
..
ADT Mark ImmutableMap::remove/add() const. 2012-12-07 19:44:12 +00:00
Analysis Add a new visitor for walking the uses of a pointer value. 2012-12-10 08:28:39 +00:00
Assembly
Bitcode Have the bitcode reader/writer just use FPMathOperator's fast math enum directly 2012-12-09 20:23:16 +00:00
CodeGen Add an MIBundleBuilder class. 2012-12-07 04:23:35 +00:00
Config llvm/Config/config.h.cmake: Good bye, Kevin! We won't honor authors in comments. 2012-10-29 16:07:28 +00:00
DebugInfo Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
ExecutionEngine Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MC Fix Windows build breakage. 2012-12-08 05:19:49 +00:00
Object Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Option Copy clang/Driver/<Option parsing stuff> to llvm. 2012-12-05 00:29:32 +00:00
Support s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future. 2012-12-07 23:16:57 +00:00
TableGen Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Target LoopVectorize: support vectorizing intrinsic calls 2012-12-09 20:42:17 +00:00
Transforms s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future. 2012-12-07 23:16:57 +00:00
AddressingMode.h Use DataTypes.h 2012-10-08 23:14:28 +00:00
Argument.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Attributes.h s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future. 2012-12-07 23:16:57 +00:00
AutoUpgrade.h
BasicBlock.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
CallGraphSCCPass.h moves doInitialization and doFinalization to the Pass class and removes some unreachable code in MachineModuleInfo 2012-12-03 21:56:57 +00:00
CallingConv.h Add the Erlang/HiPE calling convention, patch by Yiannis Tsiouris. 2012-11-16 12:36:39 +00:00
CMakeLists.txt
Constant.h Make GlobalOpt be conservative with TLS variables (PR14309) 2012-11-15 11:40:00 +00:00
Constants.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
DataLayout.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
DebugInfo.h Handle non-default array bounds. 2012-12-06 07:38:10 +00:00
DefaultPasses.h
DerivedTypes.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
DIBuilder.h Use the 'count' attribute to calculate the upper bound of an array. 2012-12-04 21:34:03 +00:00
Function.h s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future. 2012-12-07 23:16:57 +00:00
GlobalAlias.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
GlobalValue.h Remove unnecessary classof()'s 2012-10-11 23:30:49 +00:00
GlobalVariable.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
GVMaterializer.h
InitializePasses.h Initial commit of MemorySanitizer. 2012-11-29 09:57:20 +00:00
InlineAsm.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
InstrTypes.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Instruction.def
Instruction.h Reorganize FastMathFlags to be a wrapper around unsigned, and streamline some interfaces. 2012-12-09 21:12:04 +00:00
Instructions.h s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future. 2012-12-07 23:16:57 +00:00
InstVisitor.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
IntrinsicInst.h va_start, va_end, va_copy: InstrinsicInst subclasses and InstVisitor support. 2012-10-29 09:39:03 +00:00
Intrinsics.h s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future. 2012-12-07 23:16:57 +00:00
Intrinsics.td Add llvm.ceil, llvm.trunc, llvm.rint, llvm.nearbyint intrinsics. 2012-11-15 06:51:10 +00:00
IntrinsicsARM.td
IntrinsicsHexagon.td
IntrinsicsMips.td
IntrinsicsNVVM.td
IntrinsicsPowerPC.td
IntrinsicsX86.td Add support of RTM from TSX extension 2012-11-08 07:28:54 +00:00
IntrinsicsXCore.td
IRBuilder.h Fix comment typo. 2012-12-04 16:36:05 +00:00
LinkAllPasses.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
LinkAllVMCore.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Linker.h
LLVMContext.h
MDBuilder.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Metadata.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Module.h s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future. 2012-12-07 23:16:57 +00:00
OperandTraits.h
Operator.h Reorganize FastMathFlags to be a wrapper around unsigned, and streamline some interfaces. 2012-12-09 21:12:04 +00:00
Pass.h moves doInitialization and doFinalization to the Pass class and removes some unreachable code in MachineModuleInfo 2012-12-03 21:56:57 +00:00
PassAnalysisSupport.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
PassManager.h One more step towards making doInitialization and doFinalization useful for 2012-11-29 17:47:05 +00:00
PassManagers.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
PassRegistry.h
PassSupport.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
SymbolTableListTraits.h
TargetTransformInfo.h LoopVectorize: support vectorizing intrinsic calls 2012-12-09 20:42:17 +00:00
Type.h Teach Type::getPointerAddressSpace to look through pointer vectors 2012-11-01 09:37:49 +00:00
TypeBuilder.h
TypeFinder.h
Use.h
User.h Remove unnecessary classof()'s 2012-10-11 23:30:49 +00:00
Value.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
ValueSymbolTable.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00