[llvm-commits] [llvm] r116978 - in /llvm/trunk: include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/Target/X86/X86AsmPrinter.cpp

Michael J. Spencer bigcheesegs at gmail.com
Wed Oct 20 17:08:21 PDT 2010


Author: mspencer
Date: Wed Oct 20 19:08:21 2010
New Revision: 116978

URL: http://llvm.org/viewvc/llvm-project?rev=116978&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
    llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp

Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=116978&r1=116977&r2=116978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Wed Oct 20 19:08:21 2010
@@ -157,10 +157,9 @@
   /// in this module.
   bool DbgInfoAvailable;
 
-  /// True if this module calls an external function with floating point
-  /// arguments. This is used to emit an undefined reference to fltused on
-  /// Windows targets.
-  bool CallsExternalFunctionWithFloatingPointArguments;
+  /// True if this module calls VarArg function with floating point arguments.
+  /// This is used to emit an undefined reference to fltused on Windows targets.
+  bool CallsExternalVAFunctionWithFloatingPointArguments;
 
 public:
   static char ID; // Pass identification, replacement for typeid
@@ -217,12 +216,12 @@
   bool callsUnwindInit() const { return CallsUnwindInit; }
   void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
 
-  bool callsExternalFunctionWithFloatingPointArguments() const {
-    return CallsExternalFunctionWithFloatingPointArguments;
+  bool callsExternalVAFunctionWithFloatingPointArguments() const {
+    return CallsExternalVAFunctionWithFloatingPointArguments;
   }
 
-  void setCallsExternalFunctionWithFloatingPointArguments(bool b) {
-    CallsExternalFunctionWithFloatingPointArguments = b;
+  void setCallsExternalVAFunctionWithFloatingPointArguments(bool b) {
+    CallsExternalVAFunctionWithFloatingPointArguments = b;
   }
 
   /// getFrameMoves - Returns a reference to a list of moves done in the current

Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=116978&r1=116977&r2=116978&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Wed Oct 20 19:08:21 2010
@@ -257,7 +257,7 @@
 : ImmutablePass(ID), Context(MAI),
   ObjFileMMI(0),
   CurCallSite(0), CallsEHReturn(0), CallsUnwindInit(0), DbgInfoAvailable(false),
-  CallsExternalFunctionWithFloatingPointArguments(false) {
+  CallsExternalVAFunctionWithFloatingPointArguments(false) {
   initializeMachineModuleInfoPass(*PassRegistry::getPassRegistry());
   // Always emit some info, by default "no personality" info.
   Personalities.push_back(NULL);

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=116978&r1=116977&r2=116978&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Oct 20 19:08:21 2010
@@ -5030,16 +5030,16 @@
     // 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) {
+    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.setCallsExternalFunctionWithFloatingPointArguments(true);
+            MMI.setCallsExternalVAFunctionWithFloatingPointArguments(true);
             break;
           }
         }

Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=116978&r1=116977&r2=116978&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Wed Oct 20 19:08:21 2010
@@ -582,7 +582,7 @@
 
   if (Subtarget->isTargetWindows()
    && !Subtarget->isTargetCygMing()
-   && MMI->callsExternalFunctionWithFloatingPointArguments()) {
+   && MMI->callsExternalVAFunctionWithFloatingPointArguments()) {
     MCSymbol *S = MMI->getContext().GetOrCreateSymbol(StringRef("__fltused"));
     OutStreamer.EmitSymbolAttribute(S, MCSA_Global);
   }





More information about the llvm-commits mailing list