InstCombine: Fold ((A | B) & C1) ^ (B & C2) -> (A & C1) ^ B if C1^C2=-1
[oota-llvm.git] / include / llvm / Transforms / Utils / ModuleUtils.h
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
17 namespace llvm {
18
19 class Module;
20 class Function;
21 class GlobalValue;
22 class GlobalVariable;
23 template <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
29 void appendToGlobalCtors(Module &M, Function *F, int Priority);
30
31 /// Same as appendToGlobalCtors(), but for global dtors.
32 void 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.
36 GlobalVariable *collectUsedGlobalVariables(Module &M,
37                                            SmallPtrSet<GlobalValue *, 8> &Set,
38                                            bool CompilerUsed);
39 } // End llvm namespace
40
41 #endif //  LLVM_TRANSFORMS_UTILS_MODULEUTILS_H