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
24 template <class PtrType> class SmallPtrSetImpl;
26 /// Append F to the list of global ctors of module M with the given Priority.
27 /// This wraps the function in the appropriate structure and stores it along
28 /// side other global constructors. For details see
29 /// http://llvm.org/docs/LangRef.html#intg_global_ctors
30 void appendToGlobalCtors(Module &M, Function *F, int Priority);
32 /// Same as appendToGlobalCtors(), but for global dtors.
33 void appendToGlobalDtors(Module &M, Function *F, int Priority);
35 /// \brief Given "llvm.used" or "llvm.compiler.used" as a global name, collect
36 /// the initializer elements of that global in Set and return the global itself.
37 GlobalVariable *collectUsedGlobalVariables(Module &M,
38 SmallPtrSetImpl<GlobalValue *> &Set,
41 // Validate the result of Module::getOrInsertFunction called for an interface
42 // function of given sanitizer. If the instrumented module defines a function
43 // with the same name, their prototypes must match, otherwise
44 // getOrInsertFunction returns a bitcast.
45 Function *checkSanitizerInterfaceFunction(Constant *FuncOrBitcast);
46 } // End llvm namespace
48 #endif // LLVM_TRANSFORMS_UTILS_MODULEUTILS_H