aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-10-16 08:25:41 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-10-16 08:25:41 +0000
commit84ac4d5a2a8fd0e6f95ec46088c0ca7bb63423ac (patch)
tree21a10b4aece3d37416044ea441f759f25ea709cb /lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parente70c526d59e92048c89281d1b7011af0b1d9ee95 (diff)
downloadexternal_llvm-84ac4d5a2a8fd0e6f95ec46088c0ca7bb63423ac.zip
external_llvm-84ac4d5a2a8fd0e6f95ec46088c0ca7bb63423ac.tar.gz
external_llvm-84ac4d5a2a8fd0e6f95ec46088c0ca7bb63423ac.tar.bz2
X86-Windows: Emit an undefined global __fltused symbol when targeting Windows
if any floating point arguments are passed to an external function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116665 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index ebc6d38..04c424f 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -15,6 +15,7 @@
#include "SDNodeDbgValue.h"
#include "SelectionDAGBuilder.h"
#include "llvm/ADT/BitVector.h"
+#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/ConstantFolding.h"
@@ -5019,6 +5020,25 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
}
}
+ // See if any floating point values are being passed to this external
+ // function. This is used to emit an undefined reference to fltused on
+ // Windows.
+ if (!F->hasLocalLinkage() && F->hasName()) {
+ MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
+ for (unsigned i = 0, e = I.getNumArgOperands(); i != e &&
+ !MMI.callsExternalFunctionWithFloatingPointArguments(); ++i) {
+ const Type* T = I.getArgOperand(i)->getType();
+ for (po_iterator<const Type*> i = po_begin(T),
+ e = po_end(T);
+ i != e; ++i) {
+ if (i->isFloatingPointTy()) {
+ MMI.setCallsExternalFunctionWithFloatingPointArguments(true);
+ break;
+ }
+ }
+ }
+ }
+
// Check for well-known libc/libm calls. If the function is internal, it
// can't be a library call.
if (!F->hasLocalLinkage() && F->hasName()) {