LLVM API Documentation

ModuleUtils.h
Go to the documentation of this file.
00001 //===-- ModuleUtils.h - Functions to manipulate Modules ---------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This family of functions perform manipulations on Modules.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_TRANSFORMS_UTILS_MODULEUTILS_H
00015 #define LLVM_TRANSFORMS_UTILS_MODULEUTILS_H
00016 
00017 namespace llvm {
00018 
00019 class Module;
00020 class Function;
00021 class GlobalValue;
00022 class GlobalVariable;
00023 template <class PtrType> class SmallPtrSetImpl;
00024 
00025 /// Append F to the list of global ctors of module M with the given Priority.
00026 /// This wraps the function in the appropriate structure and stores it along
00027 /// side other global constructors. For details see
00028 /// http://llvm.org/docs/LangRef.html#intg_global_ctors
00029 void appendToGlobalCtors(Module &M, Function *F, int Priority);
00030 
00031 /// Same as appendToGlobalCtors(), but for global dtors.
00032 void appendToGlobalDtors(Module &M, Function *F, int Priority);
00033 
00034 /// \brief Given "llvm.used" or "llvm.compiler.used" as a global name, collect
00035 /// the initializer elements of that global in Set and return the global itself.
00036 GlobalVariable *collectUsedGlobalVariables(Module &M,
00037                                            SmallPtrSetImpl<GlobalValue *> &Set,
00038                                            bool CompilerUsed);
00039 } // End llvm namespace
00040 
00041 #endif //  LLVM_TRANSFORMS_UTILS_MODULEUTILS_H