mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
CodeGen-Windows: Only emit _fltused if a VarArg function is called with floating point args.
This should be the minimum set of functions that could possibly need it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116978 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -157,10 +157,9 @@ class MachineModuleInfo : public ImmutablePass {
|
|||||||
/// in this module.
|
/// in this module.
|
||||||
bool DbgInfoAvailable;
|
bool DbgInfoAvailable;
|
||||||
|
|
||||||
/// True if this module calls an external function with floating point
|
/// True if this module calls VarArg function with floating point arguments.
|
||||||
/// arguments. This is used to emit an undefined reference to fltused on
|
/// This is used to emit an undefined reference to fltused on Windows targets.
|
||||||
/// Windows targets.
|
bool CallsExternalVAFunctionWithFloatingPointArguments;
|
||||||
bool CallsExternalFunctionWithFloatingPointArguments;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
@ -217,12 +216,12 @@ public:
|
|||||||
bool callsUnwindInit() const { return CallsUnwindInit; }
|
bool callsUnwindInit() const { return CallsUnwindInit; }
|
||||||
void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
|
void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
|
||||||
|
|
||||||
bool callsExternalFunctionWithFloatingPointArguments() const {
|
bool callsExternalVAFunctionWithFloatingPointArguments() const {
|
||||||
return CallsExternalFunctionWithFloatingPointArguments;
|
return CallsExternalVAFunctionWithFloatingPointArguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCallsExternalFunctionWithFloatingPointArguments(bool b) {
|
void setCallsExternalVAFunctionWithFloatingPointArguments(bool b) {
|
||||||
CallsExternalFunctionWithFloatingPointArguments = b;
|
CallsExternalVAFunctionWithFloatingPointArguments = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getFrameMoves - Returns a reference to a list of moves done in the current
|
/// getFrameMoves - Returns a reference to a list of moves done in the current
|
||||||
|
@ -257,7 +257,7 @@ MachineModuleInfo::MachineModuleInfo(const MCAsmInfo &MAI)
|
|||||||
: ImmutablePass(ID), Context(MAI),
|
: ImmutablePass(ID), Context(MAI),
|
||||||
ObjFileMMI(0),
|
ObjFileMMI(0),
|
||||||
CurCallSite(0), CallsEHReturn(0), CallsUnwindInit(0), DbgInfoAvailable(false),
|
CurCallSite(0), CallsEHReturn(0), CallsUnwindInit(0), DbgInfoAvailable(false),
|
||||||
CallsExternalFunctionWithFloatingPointArguments(false) {
|
CallsExternalVAFunctionWithFloatingPointArguments(false) {
|
||||||
initializeMachineModuleInfoPass(*PassRegistry::getPassRegistry());
|
initializeMachineModuleInfoPass(*PassRegistry::getPassRegistry());
|
||||||
// Always emit some info, by default "no personality" info.
|
// Always emit some info, by default "no personality" info.
|
||||||
Personalities.push_back(NULL);
|
Personalities.push_back(NULL);
|
||||||
|
@ -5030,16 +5030,16 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
|
|||||||
// See if any floating point values are being passed to this external
|
// See if any floating point values are being passed to this external
|
||||||
// function. This is used to emit an undefined reference to fltused on
|
// function. This is used to emit an undefined reference to fltused on
|
||||||
// Windows.
|
// Windows.
|
||||||
if (!F->hasLocalLinkage() && F->hasName()) {
|
MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
|
||||||
MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
|
if (F->isVarArg() &&
|
||||||
for (unsigned i = 0, e = I.getNumArgOperands(); i != e &&
|
!MMI.callsExternalVAFunctionWithFloatingPointArguments()) {
|
||||||
!MMI.callsExternalFunctionWithFloatingPointArguments(); ++i) {
|
for (unsigned i = 0, e = I.getNumArgOperands(); i != e; ++i) {
|
||||||
const Type* T = I.getArgOperand(i)->getType();
|
const Type* T = I.getArgOperand(i)->getType();
|
||||||
for (po_iterator<const Type*> i = po_begin(T),
|
for (po_iterator<const Type*> i = po_begin(T),
|
||||||
e = po_end(T);
|
e = po_end(T);
|
||||||
i != e; ++i) {
|
i != e; ++i) {
|
||||||
if (i->isFloatingPointTy()) {
|
if (i->isFloatingPointTy()) {
|
||||||
MMI.setCallsExternalFunctionWithFloatingPointArguments(true);
|
MMI.setCallsExternalVAFunctionWithFloatingPointArguments(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -582,7 +582,7 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
|||||||
|
|
||||||
if (Subtarget->isTargetWindows()
|
if (Subtarget->isTargetWindows()
|
||||||
&& !Subtarget->isTargetCygMing()
|
&& !Subtarget->isTargetCygMing()
|
||||||
&& MMI->callsExternalFunctionWithFloatingPointArguments()) {
|
&& MMI->callsExternalVAFunctionWithFloatingPointArguments()) {
|
||||||
MCSymbol *S = MMI->getContext().GetOrCreateSymbol(StringRef("__fltused"));
|
MCSymbol *S = MMI->getContext().GetOrCreateSymbol(StringRef("__fltused"));
|
||||||
OutStreamer.EmitSymbolAttribute(S, MCSA_Global);
|
OutStreamer.EmitSymbolAttribute(S, MCSA_Global);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user