[llvm-commits] CVS: llvm/lib/CodeGen/MachineInstr.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Jan 6 12:34:02 PST 2003


Changes in directory llvm/lib/CodeGen:

MachineInstr.cpp updated: 1.67 -> 1.68

---
Log message:

Add support for constant pool


---
Diffs of the changes:

Index: llvm/lib/CodeGen/MachineInstr.cpp
diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.67 llvm/lib/CodeGen/MachineInstr.cpp:1.68
--- llvm/lib/CodeGen/MachineInstr.cpp:1.67	Sat Dec 28 14:37:37 2002
+++ llvm/lib/CodeGen/MachineInstr.cpp	Mon Jan  6 12:32:50 2003
@@ -268,6 +268,9 @@
   case MachineOperand::MO_FrameIndex:
     OS << "<fi#" << MO.getFrameIndex() << ">";
     break;
+  case MachineOperand::MO_ConstantPoolIndex:
+    OS << "<cp#" << MO.getConstantPoolIndex() << ">";
+    break;
   default:
     assert(0 && "Unrecognized operand type");
   }
@@ -316,26 +319,26 @@
 }
 
 
-std::ostream &operator<<(std::ostream& os, const MachineInstr& minstr)
+std::ostream &operator<<(std::ostream& os, const MachineInstr& MI)
 {
-  os << TargetInstrDescriptors[minstr.opCode].Name;
+  os << TargetInstrDescriptors[MI.opCode].Name;
   
-  for (unsigned i=0, N=minstr.getNumOperands(); i < N; i++) {
-    os << "\t" << minstr.getOperand(i);
-    if( minstr.operandIsDefined(i) ) 
-      os << "*";
-    if( minstr.operandIsDefinedAndUsed(i) ) 
-      os << "*";
+  for (unsigned i=0, N=MI.getNumOperands(); i < N; i++) {
+    os << "\t" << MI.getOperand(i);
+    if (MI.operandIsDefined(i))
+      os << "<d>";
+    if (MI.operandIsDefinedAndUsed(i))
+      os << "<d&u>";
   }
   
   // code for printing implict references
-  unsigned NumOfImpRefs =  minstr.getNumImplicitRefs();
-  if(  NumOfImpRefs > 0 ) {
+  unsigned NumOfImpRefs = MI.getNumImplicitRefs();
+  if (NumOfImpRefs > 0) {
     os << "\tImplicit: ";
-    for(unsigned z=0; z < NumOfImpRefs; z++) {
-      OutputValue(os, minstr.getImplicitRef(z)); 
-      if( minstr.implicitRefIsDefined(z)) os << "*";
-      if( minstr.implicitRefIsDefinedAndUsed(z)) os << "*";
+    for (unsigned z=0; z < NumOfImpRefs; z++) {
+      OutputValue(os, MI.getImplicitRef(z)); 
+      if (MI.implicitRefIsDefined(z)) os << "<d>";
+      if (MI.implicitRefIsDefinedAndUsed(z)) os << "<d&u>";
       os << "\t";
     }
   }
@@ -357,11 +360,13 @@
   switch (MO.getType())
     {
     case MachineOperand::MO_VirtualRegister:
-      OS << "%reg";
-      OutputValue(OS, MO.getVRegValue());
-      if (MO.hasAllocatedReg()) {
-        OS << "==";
+      if (MO.hasAllocatedReg())
         OutputReg(OS, MO.getAllocatedRegNum());
+
+      if (MO.getVRegValue()) {
+	if (MO.hasAllocatedReg()) OS << "==";
+	OS << "%vreg";
+	OutputValue(OS, MO.getVRegValue());
       }
       break;
     case MachineOperand::MO_CCRegister:
@@ -400,6 +405,9 @@
       break;
     case MachineOperand::MO_FrameIndex:
       OS << "<fi#" << MO.getFrameIndex() << ">";
+      break;
+    case MachineOperand::MO_ConstantPoolIndex:
+      OS << "<cp#" << MO.getConstantPoolIndex() << ">";
       break;
     default:
       assert(0 && "Unrecognized operand type");





More information about the llvm-commits mailing list