aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-02 19:23:55 +0000
committerChris Lattner <sabre@nondot.org>2010-02-02 19:23:55 +0000
commit6914b8611a29933bf23928cc539d5c09e48c5543 (patch)
tree8220e0b37f3a96ed23186f3a5a05ac8505b0c2b8 /lib
parentb5c5160a554cb0debeb7913287d9c099a753a59e (diff)
downloadexternal_llvm-6914b8611a29933bf23928cc539d5c09e48c5543.zip
external_llvm-6914b8611a29933bf23928cc539d5c09e48c5543.tar.gz
external_llvm-6914b8611a29933bf23928cc539d5c09e48c5543.tar.bz2
remove PPCMachOWriterInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/PowerPC/CMakeLists.txt1
-rw-r--r--lib/Target/PowerPC/PPCMachOWriterInfo.cpp152
-rw-r--r--lib/Target/PowerPC/PPCMachOWriterInfo.h55
-rw-r--r--lib/Target/PowerPC/PPCTargetMachine.cpp2
-rw-r--r--lib/Target/PowerPC/PPCTargetMachine.h5
5 files changed, 1 insertions, 214 deletions
diff --git a/lib/Target/PowerPC/CMakeLists.txt b/lib/Target/PowerPC/CMakeLists.txt
index bdd6d36..c997c5c 100644
--- a/lib/Target/PowerPC/CMakeLists.txt
+++ b/lib/Target/PowerPC/CMakeLists.txt
@@ -19,7 +19,6 @@ add_llvm_target(PowerPCCodeGen
PPCISelDAGToDAG.cpp
PPCISelLowering.cpp
PPCJITInfo.cpp
- PPCMachOWriterInfo.cpp
PPCMCAsmInfo.cpp
PPCPredicates.cpp
PPCRegisterInfo.cpp
diff --git a/lib/Target/PowerPC/PPCMachOWriterInfo.cpp b/lib/Target/PowerPC/PPCMachOWriterInfo.cpp
deleted file mode 100644
index 4c14454..0000000
--- a/lib/Target/PowerPC/PPCMachOWriterInfo.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-//===-- PPCMachOWriterInfo.cpp - Mach-O Writer Info for the PowerPC -------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements Mach-O writer information for the PowerPC backend.
-//
-//===----------------------------------------------------------------------===//
-
-#include "PPCMachOWriterInfo.h"
-#include "PPCRelocations.h"
-#include "PPCTargetMachine.h"
-#include "llvm/CodeGen/MachORelocation.h"
-#include "llvm/Support/OutputBuffer.h"
-#include "llvm/Support/ErrorHandling.h"
-#include <cstdio>
-using namespace llvm;
-
-PPCMachOWriterInfo::PPCMachOWriterInfo(const PPCTargetMachine &TM)
- : TargetMachOWriterInfo(TM.getTargetData()->getPointerSizeInBits() == 64 ?
- HDR_CPU_TYPE_POWERPC64 :
- HDR_CPU_TYPE_POWERPC,
- HDR_CPU_SUBTYPE_POWERPC_ALL) {}
-PPCMachOWriterInfo::~PPCMachOWriterInfo() {}
-
-/// GetTargetRelocation - For the MachineRelocation MR, convert it to one or
-/// more PowerPC MachORelocation(s), add the new relocations to the
-/// MachOSection, and rewrite the instruction at the section offset if required
-/// by that relocation type.
-unsigned PPCMachOWriterInfo::GetTargetRelocation(MachineRelocation &MR,
- unsigned FromIdx,
- unsigned ToAddr,
- unsigned ToIdx,
- OutputBuffer &RelocOut,
- OutputBuffer &SecOut,
- bool Scattered,
- bool isExtern) const {
- unsigned NumRelocs = 0;
- uint64_t Addr = 0;
-
- // Get the address of whatever it is we're relocating, if possible.
- if (!isExtern)
- Addr = (uintptr_t)MR.getResultPointer() + ToAddr;
-
- switch ((PPC::RelocationType)MR.getRelocationType()) {
- default: llvm_unreachable("Unknown PPC relocation type!");
- case PPC::reloc_absolute_low_ix:
- llvm_unreachable("Unhandled PPC relocation type!");
- break;
- case PPC::reloc_vanilla:
- {
- // FIXME: need to handle 64 bit vanilla relocs
- MachORelocation VANILLA(MR.getMachineCodeOffset(), ToIdx,
- false, 2, isExtern,
- PPC_RELOC_VANILLA,
- Scattered, (intptr_t)MR.getResultPointer());
- ++NumRelocs;
-
- if (Scattered) {
- RelocOut.outword(VANILLA.getPackedFields());
- RelocOut.outword(VANILLA.getAddress());
- } else {
- RelocOut.outword(VANILLA.getAddress());
- RelocOut.outword(VANILLA.getPackedFields());
- }
-
- intptr_t SymbolOffset;
-
- if (Scattered)
- SymbolOffset = Addr + MR.getConstantVal();
- else
- SymbolOffset = Addr;
-
- printf("vanilla fixup: sec_%x[%x] = %x\n", FromIdx,
- unsigned(MR.getMachineCodeOffset()),
- unsigned(SymbolOffset));
- SecOut.fixword(SymbolOffset, MR.getMachineCodeOffset());
- }
- break;
- case PPC::reloc_pcrel_bx:
- {
- // FIXME: Presumably someday we will need to branch to other, non-extern
- // functions too. Need to figure out some way to distinguish between
- // target is BB and target is function.
- if (isExtern) {
- MachORelocation BR24(MR.getMachineCodeOffset(), ToIdx, true, 2,
- isExtern, PPC_RELOC_BR24, Scattered,
- (intptr_t)MR.getMachineCodeOffset());
- RelocOut.outword(BR24.getAddress());
- RelocOut.outword(BR24.getPackedFields());
- ++NumRelocs;
- }
-
- Addr -= MR.getMachineCodeOffset();
- Addr >>= 2;
- Addr &= 0xFFFFFF;
- Addr <<= 2;
- Addr |= (SecOut[MR.getMachineCodeOffset()] << 24);
- Addr |= (SecOut[MR.getMachineCodeOffset()+3] & 0x3);
- SecOut.fixword(Addr, MR.getMachineCodeOffset());
- break;
- }
- case PPC::reloc_pcrel_bcx:
- {
- Addr -= MR.getMachineCodeOffset();
- Addr &= 0xFFFC;
-
- SecOut.fixhalf(Addr, MR.getMachineCodeOffset() + 2);
- break;
- }
- case PPC::reloc_absolute_high:
- {
- MachORelocation HA16(MR.getMachineCodeOffset(), ToIdx, false, 2,
- isExtern, PPC_RELOC_HA16);
- MachORelocation PAIR(Addr & 0xFFFF, 0xFFFFFF, false, 2, isExtern,
- PPC_RELOC_PAIR);
- NumRelocs = 2;
-
- RelocOut.outword(HA16.getRawAddress());
- RelocOut.outword(HA16.getPackedFields());
- RelocOut.outword(PAIR.getRawAddress());
- RelocOut.outword(PAIR.getPackedFields());
-
- Addr += 0x8000;
-
- SecOut.fixhalf(Addr >> 16, MR.getMachineCodeOffset() + 2);
- break;
- }
- case PPC::reloc_absolute_low:
- {
- MachORelocation LO16(MR.getMachineCodeOffset(), ToIdx, false, 2,
- isExtern, PPC_RELOC_LO16);
- MachORelocation PAIR(Addr >> 16, 0xFFFFFF, false, 2, isExtern,
- PPC_RELOC_PAIR);
- NumRelocs = 2;
-
- RelocOut.outword(LO16.getRawAddress());
- RelocOut.outword(LO16.getPackedFields());
- RelocOut.outword(PAIR.getRawAddress());
- RelocOut.outword(PAIR.getPackedFields());
-
- SecOut.fixhalf(Addr, MR.getMachineCodeOffset() + 2);
- break;
- }
- }
-
- return NumRelocs;
-}
diff --git a/lib/Target/PowerPC/PPCMachOWriterInfo.h b/lib/Target/PowerPC/PPCMachOWriterInfo.h
deleted file mode 100644
index d46334d..0000000
--- a/lib/Target/PowerPC/PPCMachOWriterInfo.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//===-- PPCMachOWriterInfo.h - Mach-O Writer Info for PowerPC ---*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements Mach-O writer information for the PowerPC backend.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef PPC_MACHO_WRITER_INFO_H
-#define PPC_MACHO_WRITER_INFO_H
-
-#include "llvm/Target/TargetMachOWriterInfo.h"
-
-namespace llvm {
-
- // Forward declarations
- class MachineRelocation;
- class OutputBuffer;
- class PPCTargetMachine;
-
- class PPCMachOWriterInfo : public TargetMachOWriterInfo {
- public:
- PPCMachOWriterInfo(const PPCTargetMachine &TM);
- virtual ~PPCMachOWriterInfo();
-
- virtual unsigned GetTargetRelocation(MachineRelocation &MR,
- unsigned FromIdx,
- unsigned ToAddr,
- unsigned ToIdx,
- OutputBuffer &RelocOut,
- OutputBuffer &SecOut,
- bool Scattered, bool Extern) const;
-
- // Constants for the relocation r_type field.
- // See <mach-o/ppc/reloc.h>
- enum {
- PPC_RELOC_VANILLA, // generic relocation
- PPC_RELOC_PAIR, // the second relocation entry of a pair
- PPC_RELOC_BR14, // 14 bit branch displacement to word address
- PPC_RELOC_BR24, // 24 bit branch displacement to word address
- PPC_RELOC_HI16, // a PAIR follows with the low 16 bits
- PPC_RELOC_LO16, // a PAIR follows with the high 16 bits
- PPC_RELOC_HA16, // a PAIR follows, which is sign extended to 32b
- PPC_RELOC_LO14 // LO16 with low 2 bits implicitly zero
- };
- };
-
-} // end llvm namespace
-
-#endif // PPC_MACHO_WRITER_INFO_H
diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
index c7f7882..6372542 100644
--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -45,7 +45,7 @@ PPCTargetMachine::PPCTargetMachine(const Target &T, const std::string &TT,
Subtarget(TT, FS, is64Bit),
DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this),
FrameInfo(*this, is64Bit), JITInfo(*this, is64Bit), TLInfo(*this),
- InstrItins(Subtarget.getInstrItineraryData()), MachOWriterInfo(*this) {
+ InstrItins(Subtarget.getInstrItineraryData()) {
if (getRelocationModel() == Reloc::Default) {
if (Subtarget.isDarwin())
diff --git a/lib/Target/PowerPC/PPCTargetMachine.h b/lib/Target/PowerPC/PPCTargetMachine.h
index 4afcb23..6debf5f 100644
--- a/lib/Target/PowerPC/PPCTargetMachine.h
+++ b/lib/Target/PowerPC/PPCTargetMachine.h
@@ -19,7 +19,6 @@
#include "PPCJITInfo.h"
#include "PPCInstrInfo.h"
#include "PPCISelLowering.h"
-#include "PPCMachOWriterInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetData.h"
@@ -37,7 +36,6 @@ class PPCTargetMachine : public LLVMTargetMachine {
PPCJITInfo JITInfo;
PPCTargetLowering TLInfo;
InstrItineraryData InstrItins;
- PPCMachOWriterInfo MachOWriterInfo;
public:
PPCTargetMachine(const Target &T, const std::string &TT,
@@ -58,9 +56,6 @@ public:
virtual const InstrItineraryData getInstrItineraryData() const {
return InstrItins;
}
- virtual const PPCMachOWriterInfo *getMachOWriterInfo() const {
- return &MachOWriterInfo;
- }
/// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are
/// 4-byte, 8-byte, and target default. The CIE is hard-coded to indicate that