1 //===-- ModuleUtils.h - Functions to manipulate Modules ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This family of functions perform manipulations on Modules.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TRANSFORMS_UTILS_MODULEUTILS_H
15 #define LLVM_TRANSFORMS_UTILS_MODULEUTILS_H
23 template <class PtrType> class SmallPtrSetImpl;
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
29 void appendToGlobalCtors(Module &M, Function *F, int Priority);
31 /// Same as appendToGlobalCtors(), but for global dtors.
32 void appendToGlobalDtors(Module &M, Function *F, int Priority);
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.
36 GlobalVariable *collectUsedGlobalVariables(Module &M,
37 SmallPtrSetImpl<GlobalValue *> &Set,
39 } // End llvm namespace
41 #endif // LLVM_TRANSFORMS_UTILS_MODULEUTILS_H