Make 64bit args and float args work correct with calls. Thanks to Chris
[oota-llvm.git] / lib / Target / SparcV8 / SparcV8AsmPrinter.cpp
index 36137b1a1c12335fb55d9fe55b3940260cff6f64..71210536e79a0c5c57eaca4706dd53eccf477639 100644 (file)
@@ -270,6 +270,11 @@ void V8Printer::emitGlobalConstant(const Constant *CV) {
     unsigned size = TD.getTypeSize (CV->getType ());
     O << "\t.skip\t " << size << "\n";      
     return;
+  } else if (isa<ConstantAggregateZero> (CV)) {
+    unsigned size = TD.getTypeSize (CV->getType ());
+    for (unsigned i = 0; i < size; ++i)
+         O << "\t.byte 0\n";
+    return;
   }
 
   const Type *type = CV->getType();
@@ -279,15 +284,15 @@ void V8Printer::emitGlobalConstant(const Constant *CV) {
     O << ".byte";
     break;
   case Type::UShortTyID: case Type::ShortTyID:
-    O << ".word";
+    O << ".half";
     break;
   case Type::FloatTyID: case Type::PointerTyID:
   case Type::UIntTyID: case Type::IntTyID:
-    O << ".long";
+    O << ".word";
     break;
   case Type::DoubleTyID:
   case Type::ULongTyID: case Type::LongTyID:
-    O << ".quad";
+    O << ".xword";
     break;
   default:
     assert (0 && "Can't handle printing this type of thing");
@@ -575,7 +580,7 @@ bool V8Printer::doFinalization(Module &M) {
   std::string CurSection;
 
   // Print out module-level global variables here.
-  for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
     if (I->hasInitializer()) {   // External global require no code
       O << "\n\n";
       std::string name = Mang->getValueName(I);
@@ -618,6 +623,9 @@ bool V8Printer::doFinalization(Module &M) {
           else
             SwitchSection(O, CurSection, ".data");
           break;
+        case GlobalValue::GhostLinkage:
+          std::cerr << "Should not have any unmaterialized functions!\n";
+          abort();
         }
 
         O << "\t.align " << Align << "\n";