[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp PPCTargetMachine.cpp PPCTargetMachine.h
Bill Wendling
isanbard at gmail.com
Tue Jan 16 19:51:56 PST 2007
Changes in directory llvm/lib/Target/PowerPC:
PPCMachOWriter.cpp updated: 1.9 -> 1.10
PPCTargetMachine.cpp updated: 1.112 -> 1.113
PPCTargetMachine.h updated: 1.25 -> 1.26
---
Log message:
Create the specified TargetObjInfo and use it.
---
Diffs of the changes: (+24 -18)
PPCMachOWriter.cpp | 36 ++++++++++++++++++------------------
PPCTargetMachine.cpp | 5 +++++
PPCTargetMachine.h | 1 +
3 files changed, 24 insertions(+), 18 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp
diff -u llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.9 llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.10
--- llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.9 Sat Dec 16 14:23:42 2006
+++ llvm/lib/Target/PowerPC/PPCMachOWriter.cpp Tue Jan 16 21:51:37 2007
@@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
-// This file was developed by Nate Begeman and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file was developed by Nate Begeman and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
@@ -17,6 +17,7 @@
#include "llvm/PassManager.h"
#include "llvm/CodeGen/MachOWriter.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Target/TargetObjInfo.h"
using namespace llvm;
namespace {
@@ -91,10 +92,10 @@
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());
+ TOI->outword(From.RelocBuffer, VANILLA.r_address);
+ TOI->outword(From.RelocBuffer, VANILLA.getPackedFields());
}
- fixword(From.SectionData, Addr, MR.getMachineCodeOffset());
+ TOI->fixword(From.SectionData, Addr, MR.getMachineCodeOffset());
break;
case PPC::reloc_pcrel_bx:
Addr -= MR.getMachineCodeOffset();
@@ -102,12 +103,12 @@
Addr &= 0xFFFFFF;
Addr <<= 2;
Addr |= (From.SectionData[MR.getMachineCodeOffset()] << 24);
- fixword(From.SectionData, Addr, MR.getMachineCodeOffset());
+ TOI->fixword(From.SectionData, Addr, MR.getMachineCodeOffset());
break;
case PPC::reloc_pcrel_bcx:
Addr -= MR.getMachineCodeOffset();
Addr &= 0xFFFC;
- fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2);
+ TOI->fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2);
break;
case PPC::reloc_absolute_high:
{
@@ -117,14 +118,14 @@
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());
+ TOI->outword(From.RelocBuffer, HA16.r_address);
+ TOI->outword(From.RelocBuffer, HA16.getPackedFields());
+ TOI->outword(From.RelocBuffer, PAIR.r_address);
+ TOI->outword(From.RelocBuffer, PAIR.getPackedFields());
}
printf("ha16: %x\n", (unsigned)Addr);
Addr += 0x8000;
- fixhalf(From.SectionData, Addr >> 16, MR.getMachineCodeOffset() + 2);
+ TOI->fixhalf(From.SectionData, Addr >> 16, MR.getMachineCodeOffset() + 2);
break;
case PPC::reloc_absolute_low:
{
@@ -134,13 +135,13 @@
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());
+ TOI->outword(From.RelocBuffer, LO16.r_address);
+ TOI->outword(From.RelocBuffer, LO16.getPackedFields());
+ TOI->outword(From.RelocBuffer, PAIR.r_address);
+ TOI->outword(From.RelocBuffer, PAIR.getPackedFields());
}
printf("lo16: %x\n", (unsigned)Addr);
- fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2);
+ TOI->fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2);
break;
}
}
@@ -150,4 +151,3 @@
// FIXME: do something about PIC
return MachineRelocation::getBB(Offset, PPC::reloc_vanilla, MBB);
}
-
Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.112 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.113
--- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.112 Sat Jan 6 16:27:58 2007
+++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Tue Jan 16 21:51:37 2007
@@ -13,6 +13,7 @@
#include "PPC.h"
#include "PPCTargetAsmInfo.h"
+#include "PPCTargetObjInfo.h"
#include "PPCTargetMachine.h"
#include "llvm/Module.h"
#include "llvm/PassManager.h"
@@ -34,6 +35,10 @@
return new LinuxTargetAsmInfo(*this);
}
+const TargetObjInfo *PPCTargetMachine::createTargetObjInfo() const {
+ return new MachOTargetObjInfo(*this);
+}
+
unsigned PPC32TargetMachine::getJITMatchQuality() {
#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)
if (sizeof(void*) == 4)
Index: llvm/lib/Target/PowerPC/PPCTargetMachine.h
diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.h:1.25 llvm/lib/Target/PowerPC/PPCTargetMachine.h:1.26
--- llvm/lib/Target/PowerPC/PPCTargetMachine.h:1.25 Thu Sep 7 18:39:26 2006
+++ llvm/lib/Target/PowerPC/PPCTargetMachine.h Tue Jan 16 21:51:37 2007
@@ -39,6 +39,7 @@
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
+ virtual const TargetObjInfo *createTargetObjInfo() const;
public:
PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit);
More information about the llvm-commits
mailing list