[llvm-commits] [llvm] r120097 - /llvm/trunk/lib/Target/MBlaze/MBlazeAsmPrinter.cpp

Wesley Peck peckw at wesleypeck.com
Wed Nov 24 08:32:35 PST 2010


Author: peckw
Date: Wed Nov 24 10:32:35 2010
New Revision: 120097

URL: http://llvm.org/viewvc/llvm-project?rev=120097&view=rev
Log:
Updating MBlaze .mask and .frame directives to match GCC's output and fixing regression introduced in 120095 by checking MCStreamer::hasRawTextSupport.

Modified:
    llvm/trunk/lib/Target/MBlaze/MBlazeAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/MBlaze/MBlazeAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeAsmPrinter.cpp?rev=120097&r1=120096&r2=120097&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MBlaze/MBlazeAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/MBlaze/MBlazeAsmPrinter.cpp Wed Nov 24 10:32:35 2010
@@ -60,7 +60,7 @@
       return "MBlaze Assembly Printer";
     }
 
-    void printSavedRegsBitmask(raw_ostream &O);
+    void printSavedRegsBitmask();
     void emitFrameDirective();
     virtual void EmitFunctionBodyStart();
     virtual void EmitFunctionBodyEnd();
@@ -124,10 +124,9 @@
 
 // Create a bitmask with all callee saved registers for CPU or Floating Point
 // registers. For CPU registers consider RA, GP and FP for saving if necessary.
-void MBlazeAsmPrinter::printSavedRegsBitmask(raw_ostream &O) {
+void MBlazeAsmPrinter::printSavedRegsBitmask() {
   const TargetFrameInfo *TFI = TM.getFrameInfo();
   const TargetRegisterInfo &RI = *TM.getRegisterInfo();
-  const MBlazeFunctionInfo *MBlazeFI = MF->getInfo<MBlazeFunctionInfo>();
 
   // CPU Saved Registers Bitmasks
   unsigned int CPUBitmask = 0;
@@ -152,17 +151,19 @@
                 getRegisterNumbering(RI.getRARegister()));
 
   // Print CPUBitmask
-  O << "\t.mask \t"; printHex32(CPUBitmask, O); O << ','
-    << MBlazeFI->getCPUTopSavedRegOff() << '\n';
+  OutStreamer.EmitRawText("\t.mask\t0x" + Twine::utohexstr(CPUBitmask));
 }
 
 /// Frame Directive
 void MBlazeAsmPrinter::emitFrameDirective() {
-  const TargetRegisterInfo &RI = *TM.getRegisterInfo();
+  if (!OutStreamer.hasRawTextSupport())
+    return;
 
+  const TargetRegisterInfo &RI = *TM.getRegisterInfo();
   unsigned stkReg = RI.getFrameRegister(*MF);
   unsigned retReg = RI.getRARegister();
   unsigned stkSze = MF->getFrameInfo()->getStackSize();
+  if (stkSze < 28 && MF->getFrameInfo()->adjustsStack()) stkSze = 28;
 
   OutStreamer.EmitRawText("\t.frame\t" +
                           Twine(MBlazeInstPrinter::getRegisterName(stkReg)) +
@@ -171,21 +172,27 @@
 }
 
 void MBlazeAsmPrinter::EmitFunctionEntryLabel() {
-  OutStreamer.EmitRawText("\t.ent\t" + Twine(CurrentFnSym->getName()));
+  if (OutStreamer.hasRawTextSupport())
+    OutStreamer.EmitRawText("\t.ent\t" + Twine(CurrentFnSym->getName()));
   AsmPrinter::EmitFunctionEntryLabel();
 }
 
 void MBlazeAsmPrinter::EmitFunctionBodyStart() {
+  if (!OutStreamer.hasRawTextSupport())
+    return;
+
   emitFrameDirective();
+  printSavedRegsBitmask();
 
-  SmallString<128> Str;
-  raw_svector_ostream OS(Str);
-  printSavedRegsBitmask(OS);
-  OutStreamer.EmitRawText(OS.str());
+  // SmallString<128> Str;
+  // raw_svector_ostream OS(Str);
+  // printSavedRegsBitmask(OS);
+  // OutStreamer.EmitRawText(OS.str());
 }
 
 void MBlazeAsmPrinter::EmitFunctionBodyEnd() {
-  OutStreamer.EmitRawText("\t.end\t" + Twine(CurrentFnSym->getName()));
+  if (OutStreamer.hasRawTextSupport())
+    OutStreamer.EmitRawText("\t.end\t" + Twine(CurrentFnSym->getName()));
 }
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list