Fix a subtle bug in DeadMachineInstructionElim's liveness
[oota-llvm.git] / lib / CodeGen / MachOWriter.cpp
index c2b42ec48a7ba40094f05254c09fb720e7e1e957..e90f1e9c1055c6e31861bf2d1f850b22ae832947 100644 (file)
@@ -37,6 +37,7 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/OutputBuffer.h"
 #include "llvm/Support/Streams.h"
+#include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cstring>
 using namespace llvm;
@@ -44,7 +45,7 @@ using namespace llvm;
 /// AddMachOWriter - Concrete function to add the Mach-O writer to the function
 /// pass manager.
 MachineCodeEmitter *llvm::AddMachOWriter(PassManagerBase &PM,
-                                         std::ostream &O,
+                                         raw_ostream &O,
                                          TargetMachine &TM) {
   MachOWriter *MOW = new MachOWriter(O, TM);
   PM.add(MOW);
@@ -334,8 +335,8 @@ void MachOCodeEmitter::emitJumpTables(MachineJumpTableInfo *MJTI) {
 //===----------------------------------------------------------------------===//
 
 char MachOWriter::ID = 0;
-MachOWriter::MachOWriter(std::ostream &o, TargetMachine &tm) 
-  : MachineFunctionPass((intptr_t)&ID), O(o), TM(tm) {
+MachOWriter::MachOWriter(raw_ostream &o, TargetMachine &tm) 
+  : MachineFunctionPass(&ID), O(o), TM(tm) {
   is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64;
   isLittleEndian = TM.getTargetData()->isLittleEndian();
 
@@ -840,7 +841,7 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
         abort();
         break;
       }
-    } else if (PC->getType()->isFirstClassType()) {
+    } else if (PC->getType()->isSingleValueType()) {
       unsigned char *ptr = (unsigned char *)PA;
       switch (PC->getType()->getTypeID()) {
       case Type::IntegerTyID: {
@@ -877,7 +878,7 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
         break;
       }
       case Type::FloatTyID: {
-        uint32_t val = cast<ConstantFP>(PC)->getValueAPF().convertToAPInt().
+        uint32_t val = cast<ConstantFP>(PC)->getValueAPF().bitcastToAPInt().
                         getZExtValue();
         if (TD->isBigEndian())
           val = ByteSwap_32(val);
@@ -888,7 +889,7 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
         break;
       }
       case Type::DoubleTyID: {
-        uint64_t val = cast<ConstantFP>(PC)->getValueAPF().convertToAPInt().
+        uint64_t val = cast<ConstantFP>(PC)->getValueAPF().bitcastToAPInt().
                          getZExtValue();
         if (TD->isBigEndian())
           val = ByteSwap_64(val);