1 //===-- 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 18 namespace llvm { 19 20 class Function; 21 class 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. 26 bool 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. 32 bool 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. 37 bool canTrackGlobalVariableInterprocedurally(GlobalVariable *GV); 38 39 } // end namespace llvm 40 41 #endif // LLVM_ANALYSIS_VALUELATTICEUTILS_H 42