[llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp X86AsmPrinter.h

Evan Cheng evan.cheng at apple.com
Wed Jun 28 17:33:18 PDT 2006



Changes in directory llvm/lib/Target/X86:

X86AsmPrinter.cpp updated: 1.187 -> 1.188
X86AsmPrinter.h updated: 1.21 -> 1.22
---
Log message:

Move .literal4 and .literal8 support into AsmPrinter.cpp


---
Diffs of the changes:  (+2 -57)

 X86AsmPrinter.cpp |   53 ++---------------------------------------------------
 X86AsmPrinter.h   |    6 ------
 2 files changed, 2 insertions(+), 57 deletions(-)


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.187 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.188
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.187	Wed Jun 28 12:56:43 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp	Wed Jun 28 19:33:06 2006
@@ -59,6 +59,8 @@
     PrivateGlobalPrefix = "L";     // Marker for constant pool idxs
     ConstantPoolSection = "\t.const\n";
     JumpTableSection = "\t.const\n"; // FIXME: depends on PIC mode
+    FourByteConstantSection = "\t.literal4\n";
+    EightByteConstantSection = "\t.literal8\n";
     LCOMMDirective = "\t.lcomm\t";
     COMMDirectiveTakesAlignment = false;
     HasDotTypeDotSizeDirective = false;
@@ -222,57 +224,6 @@
   return false; // success
 }
 
-void X86SharedAsmPrinter::EmitConstantPool(MachineConstantPool *MCP) {
-  if (Subtarget->TargetType != X86Subtarget::isDarwin) {
-    AsmPrinter::EmitConstantPool(MCP);
-    return;
-  }
-
-  const std::vector<MachineConstantPoolEntry> &CP = MCP->getConstants();
-  if (CP.empty()) return;
-
-  std::vector<std::pair<MachineConstantPoolEntry,unsigned> > FloatCPs;
-  std::vector<std::pair<MachineConstantPoolEntry,unsigned> > DoubleCPs;
-  std::vector<std::pair<MachineConstantPoolEntry,unsigned> > OtherCPs;
-  for (unsigned i = 0, e = CP.size(); i != e; ++i) {
-    MachineConstantPoolEntry CPE = CP[i];
-    const Constant *CV = CPE.Val;
-    const Type *Ty = CV->getType();
-    if (Ty->getTypeID() == Type::FloatTyID)
-      FloatCPs.push_back(std::make_pair(CPE, i));
-    else if (Ty->getTypeID() == Type::DoubleTyID)
-      DoubleCPs.push_back(std::make_pair(CPE, i));
-    else
-      OtherCPs.push_back(std::make_pair(CPE, i));
-  }
-  EmitConstantPool(MCP, FloatCPs,  "\t.literal4");
-  EmitConstantPool(MCP, DoubleCPs, "\t.literal8");
-  EmitConstantPool(MCP, OtherCPs,  ConstantPoolSection);
-}
-
-void
-X86SharedAsmPrinter::EmitConstantPool(MachineConstantPool *MCP,
-                 std::vector<std::pair<MachineConstantPoolEntry,unsigned> > &CP,
-                                      const char *Section) {
-  if (CP.empty()) return;
-
-  SwitchToDataSection(Section, 0);
-  EmitAlignment(MCP->getConstantPoolAlignment());
-  for (unsigned i = 0, e = CP.size(); i != e; ++i) {
-    O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << '_'
-      << CP[i].second << ":\t\t\t\t\t" << CommentString << " ";
-    WriteTypeSymbolic(O, CP[i].first.Val->getType(), 0) << '\n';
-    EmitGlobalConstant(CP[i].first.Val);
-    if (i != e-1) {
-      unsigned EntSize =
-        TM.getTargetData()->getTypeSize(CP[i].first.Val->getType());
-      unsigned ValEnd = CP[i].first.Offset + EntSize;
-      // Emit inter-object padding for alignment.
-      EmitZeros(CP[i+1].first.Offset-ValEnd);
-    }
-  }
-}
-
 /// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code
 /// for a MachineFunction to the given output stream, using the given target
 /// machine description.


Index: llvm/lib/Target/X86/X86AsmPrinter.h
diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.21 llvm/lib/Target/X86/X86AsmPrinter.h:1.22
--- llvm/lib/Target/X86/X86AsmPrinter.h:1.21	Wed Jun 28 02:55:24 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.h	Wed Jun 28 19:33:06 2006
@@ -20,7 +20,6 @@
 #include "X86TargetMachine.h"
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/DwarfWriter.h"
-#include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineDebugInfo.h"
 #include "llvm/ADT/Statistic.h"
 #include <set>
@@ -93,11 +92,6 @@
        MI->getOperand(Op+3).isGlobalAddress() ||
        MI->getOperand(Op+3).isConstantPoolIndex());
   }
-
-  virtual void EmitConstantPool(MachineConstantPool *MCP);
-  void EmitConstantPool(MachineConstantPool *MCP,
-                std::vector<std::pair<MachineConstantPoolEntry, unsigned> > &CP,
-                        const char *Section);
 };
 
 } // end namespace llvm






More information about the llvm-commits mailing list