aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineModuleInfo.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-01-16 19:59:28 +0000
committerDale Johannesen <dalej@apple.com>2008-01-16 19:59:28 +0000
commited203667063810777fcf4273cf6818ba30d15293 (patch)
treebbab28cd22822d8a79dd1706e308ea57ad90bca1 /llvm/lib/CodeGen/MachineModuleInfo.cpp
parent88d5909bedc14ab0bfc25aadeef2816c99a7abcd (diff)
downloadllvm-ed203667063810777fcf4273cf6818ba30d15293.zip
llvm-ed203667063810777fcf4273cf6818ba30d15293.tar.gz
llvm-ed203667063810777fcf4273cf6818ba30d15293.tar.bz2
Do not mark EH tables no-dead-strip unless the
associated function is so marked. llvm-svn: 46088
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineModuleInfo.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index f8796ac..5e6d4cb 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -1552,6 +1552,21 @@ bool MachineModuleInfo::Verify(Value *V) {
///
void MachineModuleInfo::AnalyzeModule(Module &M) {
SetupCompileUnits(M);
+
+ // Insert functions in the llvm.used array into UsedFunctions.
+ GlobalVariable *GV = M.getGlobalVariable("llvm.used");
+ if (!GV || !GV->hasInitializer()) return;
+
+ // Should be an array of 'i8*'.
+ ConstantArray *InitList = dyn_cast<ConstantArray>(GV->getInitializer());
+ if (InitList == 0) return;
+
+ for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
+ if (ConstantExpr *CE = dyn_cast<ConstantExpr>(InitList->getOperand(i)))
+ if (CE->getOpcode() == Instruction::BitCast)
+ if (Function *F = dyn_cast<Function>(CE->getOperand(0)))
+ UsedFunctions.insert(F);
+ }
}
/// needsFrameInfo - Returns true if we need to gather callee-saved register