ValueLatticeUtils.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //===-- ValueLatticeUtils.h - Utils for solving lattices --------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file declares common functions useful for performing data-flow analyses
  10. // that propagate values across function boundaries.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_ANALYSIS_VALUELATTICEUTILS_H
  14. #define LLVM_ANALYSIS_VALUELATTICEUTILS_H
  15. namespace llvm {
  16. class Function;
  17. class GlobalVariable;
  18. /// Determine if the values of the given function's arguments can be tracked
  19. /// interprocedurally. The value of an argument can be tracked if the function
  20. /// has local linkage and its address is not taken.
  21. bool canTrackArgumentsInterprocedurally(Function *F);
  22. /// Determine if the values of the given function's returns can be tracked
  23. /// interprocedurally. Return values can be tracked if the function has an
  24. /// exact definition and it doesn't have the "naked" attribute. Naked functions
  25. /// may contain assembly code that returns untrackable values.
  26. bool canTrackReturnsInterprocedurally(Function *F);
  27. /// Determine if the value maintained in the given global variable can be
  28. /// tracked interprocedurally. A value can be tracked if the global variable
  29. /// has local linkage and is only used by non-volatile loads and stores.
  30. bool canTrackGlobalVariableInterprocedurally(GlobalVariable *GV);
  31. } // end namespace llvm
  32. #endif // LLVM_ANALYSIS_VALUELATTICEUTILS_H