LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Loads.h
Go to the documentation of this file.
1 //===- Loads.h - Local load analysis --------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares simple local analyses for load instructions.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_ANALYSIS_LOADS_H
15 #define LLVM_ANALYSIS_LOADS_H
16 
17 #include "llvm/IR/BasicBlock.h"
18 
19 namespace llvm {
20 
21 class AliasAnalysis;
22 class DataLayout;
23 class MDNode;
24 
25 /// isSafeToLoadUnconditionally - Return true if we know that executing a load
26 /// from this value cannot trap. If it is not obviously safe to load from the
27 /// specified pointer, we do a quick local scan of the basic block containing
28 /// ScanFrom, to determine if the address is already accessed.
29 bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
30  unsigned Align, const DataLayout *TD = 0);
31 
32 /// FindAvailableLoadedValue - Scan the ScanBB block backwards (starting at
33 /// the instruction before ScanFrom) checking to see if we have the value at
34 /// the memory address *Ptr locally available within a small number of
35 /// instructions. If the value is available, return it.
36 ///
37 /// If not, return the iterator for the last validated instruction that the
38 /// value would be live through. If we scanned the entire block and didn't
39 /// find something that invalidates *Ptr or provides it, ScanFrom would be
40 /// left at begin() and this returns null. ScanFrom could also be left
41 ///
42 /// MaxInstsToScan specifies the maximum instructions to scan in the block.
43 /// If it is set to 0, it will scan the whole block. You can also optionally
44 /// specify an alias analysis implementation, which makes this more precise.
45 ///
46 /// If TBAATag is non-null and a load or store is found, the TBAA tag from the
47 /// load or store is recorded there. If there is no TBAA tag or if no access
48 /// is found, it is left unmodified.
49 Value *FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB,
50  BasicBlock::iterator &ScanFrom,
51  unsigned MaxInstsToScan = 6,
52  AliasAnalysis *AA = 0,
53  MDNode **TBAATag = 0);
54 
55 }
56 
57 #endif
Various leaf nodes.
Definition: ISDOpcodes.h:60
bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom, unsigned Align, const DataLayout *TD=0)
Definition: Loads.cpp:56
Value * FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB, BasicBlock::iterator &ScanFrom, unsigned MaxInstsToScan=6, AliasAnalysis *AA=0, MDNode **TBAATag=0)
Definition: Loads.cpp:139
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(DefaultAlign), cl::values(clEnumValN(DefaultAlign,"arm-default-align","Generate unaligned accesses only on hardware/OS ""combinations that are known to support them"), clEnumValN(StrictAlign,"arm-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"arm-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
InstListType::iterator iterator
Instruction iterators...
Definition: BasicBlock.h:99
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD