ValueLatticeUtils.h 1.8 KB

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