Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.4 KiB

  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. #ifndef LLVM_ANALYSIS_LOADS_H
  14. #define LLVM_ANALYSIS_LOADS_H
  15. #include "llvm/IR/BasicBlock.h"
  16. namespace llvm {
  17. class AliasAnalysis;
  18. class DataLayout;
  19. class MDNode;
  20. /// isSafeToLoadUnconditionally - Return true if we know that executing a load
  21. /// from this value cannot trap. If it is not obviously safe to load from the
  22. /// specified pointer, we do a quick local scan of the basic block containing
  23. /// ScanFrom, to determine if the address is already accessed.
  24. bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
  25. unsigned Align, const DataLayout *TD = 0);
  26. /// FindAvailableLoadedValue - Scan the ScanBB block backwards (starting at
  27. /// the instruction before ScanFrom) checking to see if we have the value at
  28. /// the memory address *Ptr locally available within a small number of
  29. /// instructions. If the value is available, return it.
  30. ///
  31. /// If not, return the iterator for the last validated instruction that the
  32. /// value would be live through. If we scanned the entire block and didn't
  33. /// find something that invalidates *Ptr or provides it, ScanFrom would be
  34. /// left at begin() and this returns null. ScanFrom could also be left
  35. ///
  36. /// MaxInstsToScan specifies the maximum instructions to scan in the block.
  37. /// If it is set to 0, it will scan the whole block. You can also optionally
  38. /// specify an alias analysis implementation, which makes this more precise.
  39. ///
  40. /// If TBAATag is non-null and a load or store is found, the TBAA tag from the
  41. /// load or store is recorded there. If there is no TBAA tag or if no access
  42. /// is found, it is left unmodified.
  43. Value *FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB,
  44. BasicBlock::iterator &ScanFrom,
  45. unsigned MaxInstsToScan = 6,
  46. AliasAnalysis *AA = 0,
  47. MDNode **TBAATag = 0);
  48. }
  49. #endif