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

Evan Cheng evan.cheng at apple.com
Thu Mar 8 00:32:45 PST 2007



Changes in directory llvm/lib/Target/PowerPC:

PPCAsmPrinter.cpp updated: 1.236 -> 1.237
---
Log message:

Putting more constants which do not contain relocations into .literal{4|8|16}

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

 PPCAsmPrinter.cpp |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.236 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.237
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.236	Wed Mar  7 19:25:25 2007
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp	Thu Mar  8 02:31:54 2007
@@ -701,7 +701,10 @@
                                                 + ",\"aw\", at progbits";
           SwitchToDataSection(SectionName.c_str());
         } else {
-          SwitchToDataSection(TAI->getDataSection(), I);
+          if (I->isConstant() && TAI->getReadOnlySection())
+            SwitchToDataSection(TAI->getReadOnlySection(), I);
+          else
+            SwitchToDataSection(TAI->getDataSection(), I);
         }
         break;
       default:
@@ -942,17 +945,17 @@
           SwitchToDataSection(TAI->getDataSection(), I);
         else {
           // Read-only data.
-          bool isIntFPLiteral = Type->isInteger()  || Type->isFloatingPoint();
-          if (C->ContainsRelocations() &&
+          bool HasReloc = C->ContainsRelocations();
+          if (HasReloc &&
               TM.getRelocationModel() != Reloc::Static)
             SwitchToDataSection("\t.const_data\n");
-          else if (isIntFPLiteral && Size == 4 &&
+          else if (!HasReloc && Size == 4 &&
                    TAI->getFourByteConstantSection())
             SwitchToDataSection(TAI->getFourByteConstantSection(), I);
-          else if (isIntFPLiteral && Size == 8 &&
+          else if (!HasReloc && Size == 8 &&
                    TAI->getEightByteConstantSection())
             SwitchToDataSection(TAI->getEightByteConstantSection(), I);
-          else if (isIntFPLiteral && Size == 16 &&
+          else if (!HasReloc && Size == 16 &&
                    TAI->getSixteenByteConstantSection())
             SwitchToDataSection(TAI->getSixteenByteConstantSection(), I);
           else if (TAI->getReadOnlySection())






More information about the llvm-commits mailing list