blob: 02072672e56ed174b3e81376ed211f111a9bfebc [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===-- ValueLatticeUtils.h - Utils for solving lattices --------*- C++ -*-===//
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 common functions useful for performing data-flow analyses
11// that propagate values across function boundaries.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_ANALYSIS_VALUELATTICEUTILS_H
16#define LLVM_ANALYSIS_VALUELATTICEUTILS_H
17
18namespace llvm {
19
20class Function;
21class GlobalVariable;
22
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.
26bool canTrackArgumentsInterprocedurally(Function *F);
27
28/// Determine if the values of the given function's returns can be tracked
29/// interprocedurally. Return values can be tracked if the function has an
30/// exact definition and it doesn't have the "naked" attribute. Naked functions
31/// may contain assembly code that returns untrackable values.
32bool canTrackReturnsInterprocedurally(Function *F);
33
34/// Determine if the value maintained in the given global variable can be
35/// tracked interprocedurally. A value can be tracked if the global variable
36/// has local linkage and is only used by non-volatile loads and stores.
37bool canTrackGlobalVariableInterprocedurally(GlobalVariable *GV);
38
39} // end namespace llvm
40
41#endif // LLVM_ANALYSIS_VALUELATTICEUTILS_H