Putting more constants which do not contain relocations into .literal{4|8|16}
authorEvan Cheng <evan.cheng@apple.com>
Thu, 8 Mar 2007 08:31:54 +0000 (08:31 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 8 Mar 2007 08:31:54 +0000 (08:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35026 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMAsmPrinter.cpp
lib/Target/PowerPC/PPCAsmPrinter.cpp
lib/Target/X86/X86AsmPrinter.cpp

index fc65144f57e7b292b9a69271e77120da03603fae..03ac17bf96105b89325f9ecbbef23b9563c7b62e 100644 (file)
@@ -834,17 +834,18 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
           SwitchToDataSection(TAI->getDataSection(), I);
         else {
           // Read-only data.
-          bool isIntFPLiteral = Type->isInteger()  || Type->isFloatingPoint();
-          if (C->ContainsRelocations() && Subtarget->isTargetDarwin() &&
+          bool HasReloc = C->ContainsRelocations();
+          if (HasReloc &&
+              Subtarget->isTargetDarwin() &&
               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())
index e16303e888db4acafaac2403a08a88017a6bd1ae..7f57f69656f1b38d539de277a9867aaa418fffbf 100644 (file)
@@ -701,7 +701,10 @@ bool LinuxAsmPrinter::doFinalization(Module &M) {
                                                 + ",\"aw\",@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 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
           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())
index ad9a1e8e9f00714f8012498e1ea43eab13c9cf5b..81ec50e345ea28b92371fb38bd8ab00abf23fd5c 100644 (file)
@@ -255,17 +255,18 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
           SwitchToDataSection(TAI->getDataSection(), I);
         else {
           // Read-only data.
-          bool isIntFPLiteral = Type->isInteger()  || Type->isFloatingPoint();
-          if (C->ContainsRelocations() && Subtarget->isTargetDarwin() &&
+          bool HasReloc = C->ContainsRelocations();
+          if (HasReloc &&
+              Subtarget->isTargetDarwin() &&
               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())