[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Wed Aug 25 12:37:36 PDT 2004



Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.194 -> 1.195
---
Log message:

Previous checkin broke printf(%a) support for fp constants-- re-fix it.


---
Diffs of the changes:  (+9 -1)

Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.194 llvm/lib/Target/CBackend/Writer.cpp:1.195
--- llvm/lib/Target/CBackend/Writer.cpp:1.194	Wed Aug 25 14:00:42 2004
+++ llvm/lib/Target/CBackend/Writer.cpp	Wed Aug 25 14:37:26 2004
@@ -590,7 +590,15 @@
         Out << "LLVM_INF" << (FPC->getType() == Type::FloatTy ? "F" : "")
             << " /*inf*/ ";
       } else {
-        std::string Num = ftostr(FPC->getValue());
+        std::string Num;
+#if HAVE_PRINTF_A
+        // Print out the constant as a floating point number.
+        char Buffer[100];
+        sprintf(Buffer, "%a", FPC->getValue());
+        Num = Buffer;
+#else
+        Num = ftostr(FPC->getValue());
+#endif
         Out << Num;
       }
     }






More information about the llvm-commits mailing list