Changes in directory llvm/lib/Target/PowerPC:

PPCMachOWriter.cpp updated: 1.11 -> 1.12
---
Log message:

Changed to use the OutputBuffer instead of the methods in MachO and ELF
writers.


---
Diffs of the changes:  (+52 -31)

 PPCMachOWriter.cpp |   83 +++++++++++++++++++++++++++++++++--------------------
 1 files changed, 52 insertions(+), 31 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp
diff -u llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.11 
llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.12
--- llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.11     Wed Jan 17 03:06:13 2007
+++ llvm/lib/Target/PowerPC/PPCMachOWriter.cpp  Wed Jan 17 16:22:31 2007
@@ -17,6 +17,7 @@
 #include "llvm/PassManager.h"
 #include "llvm/CodeGen/MachOWriter.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/Support/OutputBuffer.h"
 using namespace llvm;
 
 namespace {
@@ -91,24 +92,36 @@
       MachORelocation VANILLA(MR.getMachineCodeOffset(), To.Index, false, 2, 
                               isExtern, PPC_RELOC_VANILLA);
       ++From.nreloc;
-      outword(From.RelocBuffer, VANILLA.r_address);
-      outword(From.RelocBuffer, VANILLA.getPackedFields());
+
+      OutputBuffer RelocOut(TM, From.RelocBuffer);
+      RelocOut.outword(VANILLA.r_address);
+      RelocOut.outword(VANILLA.getPackedFields());
+
+      OutputBuffer SecOut(TM, From.SectionData);
+      SecOut.fixword(Addr, MR.getMachineCodeOffset());
+      break;
     }
-    fixword(From.SectionData, Addr, MR.getMachineCodeOffset());
-    break;
   case PPC::reloc_pcrel_bx:
-    Addr -= MR.getMachineCodeOffset();
-    Addr >>= 2;
-    Addr &= 0xFFFFFF;
-    Addr <<= 2;
-    Addr |= (From.SectionData[MR.getMachineCodeOffset()] << 24);
-    fixword(From.SectionData, Addr, MR.getMachineCodeOffset());
-    break;
+    {
+      Addr -= MR.getMachineCodeOffset();
+      Addr >>= 2;
+      Addr &= 0xFFFFFF;
+      Addr <<= 2;
+      Addr |= (From.SectionData[MR.getMachineCodeOffset()] << 24);
+
+      OutputBuffer SecOut(TM, From.SectionData);
+      SecOut.fixword(Addr, MR.getMachineCodeOffset());
+      break;
+    }
   case PPC::reloc_pcrel_bcx:
-    Addr -= MR.getMachineCodeOffset();
-    Addr &= 0xFFFC;
-    fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2);
-    break;
+    {
+      Addr -= MR.getMachineCodeOffset();
+      Addr &= 0xFFFC;
+
+      OutputBuffer SecOut(TM, From.SectionData);
+      SecOut.fixhalf(Addr, MR.getMachineCodeOffset() + 2);
+      break;
+    }
   case PPC::reloc_absolute_high:
     {
       MachORelocation HA16(MR.getMachineCodeOffset(), To.Index, false, 2,
@@ -117,15 +130,19 @@
                            PPC_RELOC_PAIR);
       ++From.nreloc;
       ++From.nreloc;
-      outword(From.RelocBuffer, HA16.r_address);
-      outword(From.RelocBuffer, HA16.getPackedFields());
-      outword(From.RelocBuffer, PAIR.r_address);
-      outword(From.RelocBuffer, PAIR.getPackedFields());
-    }
-    printf("ha16: %x\n", (unsigned)Addr);
-    Addr += 0x8000;
-    fixhalf(From.SectionData, Addr >> 16, MR.getMachineCodeOffset() + 2);
-    break;
+
+      OutputBuffer RelocOut(TM, From.RelocBuffer);
+      RelocOut.outword(HA16.r_address);
+      RelocOut.outword(HA16.getPackedFields());
+      RelocOut.outword(PAIR.r_address);
+      RelocOut.outword(PAIR.getPackedFields());
+      printf("ha16: %x\n", (unsigned)Addr);
+      Addr += 0x8000;
+
+      OutputBuffer SecOut(TM, From.SectionData);
+      SecOut.fixhalf(Addr >> 16, MR.getMachineCodeOffset() + 2);
+      break;
+    }
   case PPC::reloc_absolute_low:
     {
       MachORelocation LO16(MR.getMachineCodeOffset(), To.Index, false, 2,
@@ -134,14 +151,18 @@
                            PPC_RELOC_PAIR);
       ++From.nreloc;
       ++From.nreloc;
-      outword(From.RelocBuffer, LO16.r_address);
-      outword(From.RelocBuffer, LO16.getPackedFields());
-      outword(From.RelocBuffer, PAIR.r_address);
-      outword(From.RelocBuffer, PAIR.getPackedFields());
+
+      OutputBuffer RelocOut(TM, From.RelocBuffer);
+      RelocOut.outword(LO16.r_address);
+      RelocOut.outword(LO16.getPackedFields());
+      RelocOut.outword(PAIR.r_address);
+      RelocOut.outword(PAIR.getPackedFields());
+      printf("lo16: %x\n", (unsigned)Addr);
+
+      OutputBuffer SecOut(TM, From.SectionData);
+      SecOut.fixhalf(Addr, MR.getMachineCodeOffset() + 2);
+      break;
     }
-    printf("lo16: %x\n", (unsigned)Addr);
-    fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2);
-    break;
   }
 }
 



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to