ModuleUtils.h revision 263508
1//===-- ModuleUtils.h - Functions to manipulate Modules ---------*- 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 family of functions perform manipulations on Modules.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TRANSFORMS_UTILS_MODULEUTILS_H
15#define LLVM_TRANSFORMS_UTILS_MODULEUTILS_H
16
17namespace llvm {
18
19class Module;
20class Function;
21class GlobalValue;
22class GlobalVariable;
23template <class PtrType, unsigned SmallSize> class SmallPtrSet;
24
25/// Append F to the list of global ctors of module M with the given Priority.
26/// This wraps the function in the appropriate structure and stores it along
27/// side other global constructors. For details see
28/// http://llvm.org/docs/LangRef.html#intg_global_ctors
29void appendToGlobalCtors(Module &M, Function *F, int Priority);
30
31/// Same as appendToGlobalCtors(), but for global dtors.
32void appendToGlobalDtors(Module &M, Function *F, int Priority);
33
34/// \brief Given "llvm.used" or "llvm.compiler.used" as a global name, collect
35/// the initializer elements of that global in Set and return the global itself.
36GlobalVariable *collectUsedGlobalVariables(Module &M,
37                                           SmallPtrSet<GlobalValue *, 8> &Set,
38                                           bool CompilerUsed);
39} // End llvm namespace
40
41#endif //  LLVM_TRANSFORMS_UTILS_MODULEUTILS_H
42