summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-17 00:26:12 +0000
committerChris Lattner <sabre@nondot.org>2009-04-17 00:26:12 +0000
commita8919d0a355aeac0d23cb6c45b5f74d92d8e4d69 (patch)
tree00e068ad7d0eea13a56993c6859483dbcefe8a51
parente24cbc0f4b692d295a8cbfed2ff519749728e4e8 (diff)
downloadbcm5719-llvm-a8919d0a355aeac0d23cb6c45b5f74d92d8e4d69.tar.gz
bcm5719-llvm-a8919d0a355aeac0d23cb6c45b5f74d92d8e4d69.zip
Fix some failures in targets on available_externally functions,
this fixes a crash on CodeGen/Generic/externally_available.ll on ppc hosts. Thanks to Nicholas L for pointing this out. llvm-svn: 69333
-rw-r--r--llvm/lib/Target/CBackend/CBackend.cpp5
-rw-r--r--llvm/lib/Target/MSIL/MSILWriter.cpp6
-rw-r--r--llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp6
3 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp
index fc99f503f1d..8b2473b1bad 100644
--- a/llvm/lib/Target/CBackend/CBackend.cpp
+++ b/llvm/lib/Target/CBackend/CBackend.cpp
@@ -116,6 +116,11 @@ namespace {
virtual bool doInitialization(Module &M);
bool runOnFunction(Function &F) {
+ // Do not codegen any 'available_externally' functions at all, they have
+ // definitions outside the translation unit.
+ if (F.hasAvailableExternallyLinkage())
+ return false;
+
LI = &getAnalysis<LoopInfo>();
// Get rid of intrinsics we can't handle.
diff --git a/llvm/lib/Target/MSIL/MSILWriter.cpp b/llvm/lib/Target/MSIL/MSILWriter.cpp
index 077145b321a..6b572f35a53 100644
--- a/llvm/lib/Target/MSIL/MSILWriter.cpp
+++ b/llvm/lib/Target/MSIL/MSILWriter.cpp
@@ -93,6 +93,12 @@ char MSILWriter::ID = 0;
bool MSILWriter::runOnFunction(Function &F) {
if (F.isDeclaration()) return false;
+
+ // Do not codegen any 'available_externally' functions at all, they have
+ // definitions outside the translation unit.
+ if (F.hasAvailableExternallyLinkage())
+ return false;
+
LInfo = &getAnalysis<LoopInfo>();
printFunction(F);
return false;
diff --git a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
index 426ec467620..823e3162191 100644
--- a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
@@ -25,6 +25,7 @@
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Constants.h"
+#include "llvm/Function.h"
#include "llvm/GlobalValue.h"
#include "llvm/Intrinsics.h"
#include "llvm/Support/Debug.h"
@@ -49,6 +50,11 @@ namespace {
PPCSubTarget(*TM.getSubtargetImpl()) {}
virtual bool runOnFunction(Function &Fn) {
+ // Do not codegen any 'available_externally' functions at all, they have
+ // definitions outside the translation unit.
+ if (Fn.hasAvailableExternallyLinkage())
+ return false;
+
// Make sure we re-emit a set of the global base reg if necessary
GlobalBaseReg = 0;
SelectionDAGISel::runOnFunction(Fn);
OpenPOWER on IntegriCloud