summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-10-21 20:49:23 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-10-21 20:49:23 +0000
commit0e36e0340aa208848a815b66d6eeb9827d27e908 (patch)
treef041f979368600e99af8f4387ab3733457588bd9 /llvm/lib
parent2bfa8ed045d3aad76c3a694f273a4a5beb47d94f (diff)
downloadbcm5719-llvm-0e36e0340aa208848a815b66d6eeb9827d27e908.tar.gz
bcm5719-llvm-0e36e0340aa208848a815b66d6eeb9827d27e908.zip
X86: Base _fltused on the FunctionType of the called value instead of the potentially null "CalledFunction". Thanks Duncan!
This is needed for indirect calls. llvm-svn: 117061
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 4be2525cfa1..b5597f83d0f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -5010,6 +5010,26 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
return;
}
+ // See if any floating point values are being passed to this function. This is
+ // used to emit an undefined reference to fltused on Windows.
+ const FunctionType *FT =
+ cast<FunctionType>(I.getCalledValue()->getType()->getContainedType(0));
+ MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
+ if (FT->isVarArg() &&
+ !MMI.callsExternalVAFunctionWithFloatingPointArguments()) {
+ for (unsigned i = 0, e = I.getNumArgOperands(); i != e; ++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.setCallsExternalVAFunctionWithFloatingPointArguments(true);
+ break;
+ }
+ }
+ }
+ }
+
const char *RenameFn = 0;
if (Function *F = I.getCalledFunction()) {
if (F->isDeclaration()) {
@@ -5027,25 +5047,6 @@ 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.
- MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
- if (F->isVarArg() &&
- !MMI.callsExternalVAFunctionWithFloatingPointArguments()) {
- for (unsigned i = 0, e = I.getNumArgOperands(); i != e; ++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.setCallsExternalVAFunctionWithFloatingPointArguments(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()) {
OpenPOWER on IntegriCloud