[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Aug 16 19:29:10 PDT 2004



Changes in directory llvm/lib/Target/PowerPC:

PPC32AsmPrinter.cpp updated: 1.44 -> 1.45
---
Log message:

Make sure to put an _ prefix on all identifiers!

Also, add some (currently disabled) code to print float's as 32-bits.


---
Diffs of the changes:  (+29 -16)

Index: llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.44 llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.45
--- llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.44	Mon Aug 16 18:38:36 2004
+++ llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp	Mon Aug 16 21:29:00 2004
@@ -46,7 +46,9 @@
     std::set<std::string> Strings;
 
     PowerPCAsmPrinter(std::ostream &O, TargetMachine &TM)
-      : AsmPrinter(O, TM), LabelNumber(0) {}
+      : AsmPrinter(O, TM), LabelNumber(0) {
+      UsesUnderscorePrefix = 1;
+    }
 
     /// Unique incrementer for label values for referencing Global values.
     ///
@@ -193,21 +195,32 @@
     // FP Constants are printed as integer constants to avoid losing
     // precision...
     double Val = CFP->getValue();
-    union DU {                            // Abide by C TBAA rules
-      double FVal;
-      uint64_t UVal;
-      struct {
-        uint32_t MSWord;
-        uint32_t LSWord;
-      } T;
-    } U;
-    U.FVal = Val;
-    
-    O << ".long\t" << U.T.MSWord << "\t; double most significant word " 
-      << Val << "\n";
-    O << ".long\t" << U.T.LSWord << "\t; double least significant word " 
-      << Val << "\n";
-    return;
+    if (1 || CFP->getType() == Type::DoubleTy) {
+      union DU {                            // Abide by C TBAA rules
+        double FVal;
+        uint64_t UVal;
+        struct {
+          uint32_t MSWord;
+          uint32_t LSWord;
+        } T;
+      } U;
+      U.FVal = Val;
+      
+      O << ".long\t" << U.T.MSWord << "\t; double most significant word " 
+        << Val << "\n";
+      O << ".long\t" << U.T.LSWord << "\t; double least significant word " 
+        << Val << "\n";
+      return;
+    } else {
+      union FU {                            // Abide by C TBAA rules
+        float FVal;
+        int32_t UVal;
+      } U;
+      U.FVal = Val;
+      
+      O << ".long\t" << U.UVal << "\t; float " << Val << "\n";
+      return;
+    }
   } else if (CV->getType() == Type::ULongTy || CV->getType() == Type::LongTy) {
     if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
       union DU {                            // Abide by C TBAA rules






More information about the llvm-commits mailing list