mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
X86: Base _fltused on the FunctionType of the called value instead of the potentially null "CalledFunction". Thanks Duncan!
This is needed for indirect calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117061 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
90d4cf9314
commit
391b43bf33
@ -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()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user