diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-10-16 08:25:41 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-10-16 08:25:41 +0000 |
commit | 5e683250ee0ca1d0a0c2cdbc5950ec0556653113 (patch) | |
tree | 55340dcc542d2085ce06b6f722203507da6c4edb /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | |
parent | d3ea25e66e1ad5d0d36e15837daca030b3301a69 (diff) | |
download | bcm5719-llvm-5e683250ee0ca1d0a0c2cdbc5950ec0556653113.tar.gz bcm5719-llvm-5e683250ee0ca1d0a0c2cdbc5950ec0556653113.zip |
X86-Windows: Emit an undefined global __fltused symbol when targeting Windows
if any floating point arguments are passed to an external function.
llvm-svn: 116665
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index ebc6d3837e8..04c424f6729 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/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()) { |