aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-25 03:23:25 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-25 03:23:25 +0000
commit4ef7eafa3f823443d1b8921f6020d946612281db (patch)
tree1ca8130a3a9a9f232e158eadaafb595ee57fd1d9 /include
parentb97b1627316ef4a9eb7591ef4f814917ba054ff6 (diff)
downloadexternal_llvm-4ef7eafa3f823443d1b8921f6020d946612281db.zip
external_llvm-4ef7eafa3f823443d1b8921f6020d946612281db.tar.gz
external_llvm-4ef7eafa3f823443d1b8921f6020d946612281db.tar.bz2
Respect llvm.used in Internalize.
The language reference says that: "If a symbol appears in the @llvm.used list, then the compiler, assembler, and linker are required to treat the symbol as if there is a reference to the symbol that it cannot see" Since even the linker cannot see the reference, we must assume that the reference can be using the symbol table. For example, a user can add __attribute__((used)) to a debug helper function like dump and use it from a debugger. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Transforms/Utils/ModuleUtils.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/Transforms/Utils/ModuleUtils.h b/include/llvm/Transforms/Utils/ModuleUtils.h
index bb7fc06..98a19ed 100644
--- a/include/llvm/Transforms/Utils/ModuleUtils.h
+++ b/include/llvm/Transforms/Utils/ModuleUtils.h
@@ -18,6 +18,9 @@ namespace llvm {
class Module;
class Function;
+class GlobalValue;
+class GlobalVariable;
+template <class PtrType, unsigned SmallSize> class SmallPtrSet;
/// Append F to the list of global ctors of module M with the given Priority.
/// This wraps the function in the appropriate structure and stores it along
@@ -28,6 +31,11 @@ void appendToGlobalCtors(Module &M, Function *F, int Priority);
/// Same as appendToGlobalCtors(), but for global dtors.
void appendToGlobalDtors(Module &M, Function *F, int Priority);
+/// \brief Given "llvm.used" or "llvm.compiler.used" as a global name, collect
+/// the initializer elements of that global in Set and return the global itself.
+GlobalVariable *collectUsedGlobalVariables(Module &M,
+ SmallPtrSet<GlobalValue *, 8> &Set,
+ bool CompilerUsed);
} // End llvm namespace
#endif // LLVM_TRANSFORMS_UTILS_MODULEUTILS_H