summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/PowerPC/PPCMachOWriter.cpp36
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetMachine.cpp5
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetMachine.h1
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetObjInfo.cpp22
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetObjInfo.h145
-rw-r--r--llvm/lib/Target/TargetMachine.cpp2
-rw-r--r--llvm/lib/Target/X86/X86TargetMachine.cpp5
-rw-r--r--llvm/lib/Target/X86/X86TargetMachine.h1
-rw-r--r--llvm/lib/Target/X86/X86TargetObjInfo.cpp22
-rw-r--r--llvm/lib/Target/X86/X86TargetObjInfo.h141
10 files changed, 18 insertions, 362 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCMachOWriter.cpp b/llvm/lib/Target/PowerPC/PPCMachOWriter.cpp
index d79aa48d362..ccf2e97a732 100644
--- a/llvm/lib/Target/PowerPC/PPCMachOWriter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMachOWriter.cpp
@@ -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,7 +17,6 @@
#include "llvm/PassManager.h"
#include "llvm/CodeGen/MachOWriter.h"
#include "llvm/Support/Compiler.h"
-#include "llvm/Target/TargetObjInfo.h"
using namespace llvm;
namespace {
@@ -92,10 +91,10 @@ void PPCMachOWriter::GetTargetRelocation(MachineRelocation &MR,
MachORelocation VANILLA(MR.getMachineCodeOffset(), To.Index, false, 2,
isExtern, PPC_RELOC_VANILLA);
++From.nreloc;
- TOI->outword(From.RelocBuffer, VANILLA.r_address);
- TOI->outword(From.RelocBuffer, VANILLA.getPackedFields());
+ outword(From.RelocBuffer, VANILLA.r_address);
+ outword(From.RelocBuffer, VANILLA.getPackedFields());
}
- TOI->fixword(From.SectionData, Addr, MR.getMachineCodeOffset());
+ fixword(From.SectionData, Addr, MR.getMachineCodeOffset());
break;
case PPC::reloc_pcrel_bx:
Addr -= MR.getMachineCodeOffset();
@@ -103,12 +102,12 @@ void PPCMachOWriter::GetTargetRelocation(MachineRelocation &MR,
Addr &= 0xFFFFFF;
Addr <<= 2;
Addr |= (From.SectionData[MR.getMachineCodeOffset()] << 24);
- TOI->fixword(From.SectionData, Addr, MR.getMachineCodeOffset());
+ fixword(From.SectionData, Addr, MR.getMachineCodeOffset());
break;
case PPC::reloc_pcrel_bcx:
Addr -= MR.getMachineCodeOffset();
Addr &= 0xFFFC;
- TOI->fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2);
+ fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2);
break;
case PPC::reloc_absolute_high:
{
@@ -118,14 +117,14 @@ void PPCMachOWriter::GetTargetRelocation(MachineRelocation &MR,
PPC_RELOC_PAIR);
++From.nreloc;
++From.nreloc;
- 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());
+ 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;
- TOI->fixhalf(From.SectionData, Addr >> 16, MR.getMachineCodeOffset() + 2);
+ fixhalf(From.SectionData, Addr >> 16, MR.getMachineCodeOffset() + 2);
break;
case PPC::reloc_absolute_low:
{
@@ -135,13 +134,13 @@ void PPCMachOWriter::GetTargetRelocation(MachineRelocation &MR,
PPC_RELOC_PAIR);
++From.nreloc;
++From.nreloc;
- 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());
+ outword(From.RelocBuffer, LO16.r_address);
+ outword(From.RelocBuffer, LO16.getPackedFields());
+ outword(From.RelocBuffer, PAIR.r_address);
+ outword(From.RelocBuffer, PAIR.getPackedFields());
}
printf("lo16: %x\n", (unsigned)Addr);
- TOI->fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2);
+ fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2);
break;
}
}
@@ -151,3 +150,4 @@ MachineRelocation PPCMachOWriter::GetJTRelocation(unsigned Offset,
// FIXME: do something about PIC
return MachineRelocation::getBB(Offset, PPC::reloc_vanilla, MBB);
}
+
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
index 97b7983b16e..11f334725e1 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -13,7 +13,6 @@
#include "PPC.h"
#include "PPCTargetAsmInfo.h"
-#include "PPCTargetObjInfo.h"
#include "PPCTargetMachine.h"
#include "llvm/Module.h"
#include "llvm/PassManager.h"
@@ -35,10 +34,6 @@ const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const {
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)
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.h b/llvm/lib/Target/PowerPC/PPCTargetMachine.h
index b56892df028..777772e1fae 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.h
+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.h
@@ -39,7 +39,6 @@ class PPCTargetMachine : public LLVMTargetMachine {
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
- virtual const TargetObjInfo *createTargetObjInfo() const;
public:
PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit);
diff --git a/llvm/lib/Target/PowerPC/PPCTargetObjInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetObjInfo.cpp
deleted file mode 100644
index f57f35e7401..00000000000
--- a/llvm/lib/Target/PowerPC/PPCTargetObjInfo.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===-- PPCTargetObjInfo.cpp - Object File Info ----------------------------==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Bill Wendling and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines target object file properties for PowerPC.
-//
-//===----------------------------------------------------------------------===//
-
-#include "PPCTargetObjInfo.h"
-#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetMachine.h"
-using namespace llvm;
-
-MachOTargetObjInfo::MachOTargetObjInfo(const TargetMachine &tm)
- : TM(tm),
- is64Bit(TM.getTargetData()->getPointerSizeInBits() == 64),
- isLittleEndian(TM.getTargetData()->isLittleEndian()) {}
diff --git a/llvm/lib/Target/PowerPC/PPCTargetObjInfo.h b/llvm/lib/Target/PowerPC/PPCTargetObjInfo.h
deleted file mode 100644
index 4c44fb38194..00000000000
--- a/llvm/lib/Target/PowerPC/PPCTargetObjInfo.h
+++ /dev/null
@@ -1,145 +0,0 @@
-//===-- PPCTargetObjInfo.h - Object File Info --------------------*- C++ -*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Bill Wendling and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines target object file properties for PowerPC.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef PPCTARGETOBJINFO_H
-#define PPCTARGETOBJINFO_H
-
-#include "llvm/Target/TargetObjInfo.h"
-
-namespace llvm {
-
- class TargetMachine;
-
- struct MachOTargetObjInfo : public TargetObjInfo {
- MachOTargetObjInfo(const TargetMachine &PPC_TM);
-
- // align - Emit padding into the file until the current output position is
- // aligned to the specified power of two boundary.
- virtual void align(DataBuffer &Output, unsigned Boundary) const {
- assert(Boundary && (Boundary & (Boundary-1)) == 0 &&
- "Must align to 2^k boundary");
- size_t Size = Output.size();
-
- if (Size & (Boundary-1)) {
- // Add padding to get alignment to the correct place.
- size_t Pad = Boundary - (Size & (Boundary - 1));
- Output.resize(Size + Pad);
- }
- }
-
- //===------------------------------------------------------------------===//
- // Out Functions - Output the specified value to the data buffer.
-
- virtual void outbyte(DataBuffer &Output, unsigned char X) const {
- Output.push_back(X);
- }
- virtual void outhalf(DataBuffer &Output, unsigned short X) const {
- if (isLittleEndian) {
- Output.push_back(X & 255);
- Output.push_back(X >> 8);
- } else {
- Output.push_back(X >> 8);
- Output.push_back(X & 255);
- }
- }
- virtual void outword(DataBuffer &Output, unsigned X) const {
- if (isLittleEndian) {
- Output.push_back((X >> 0) & 255);
- Output.push_back((X >> 8) & 255);
- Output.push_back((X >> 16) & 255);
- Output.push_back((X >> 24) & 255);
- } else {
- Output.push_back((X >> 24) & 255);
- Output.push_back((X >> 16) & 255);
- Output.push_back((X >> 8) & 255);
- Output.push_back((X >> 0) & 255);
- }
- }
- virtual void outxword(DataBuffer &Output, uint64_t X) const {
- if (isLittleEndian) {
- Output.push_back(unsigned(X >> 0) & 255);
- Output.push_back(unsigned(X >> 8) & 255);
- Output.push_back(unsigned(X >> 16) & 255);
- Output.push_back(unsigned(X >> 24) & 255);
- Output.push_back(unsigned(X >> 32) & 255);
- Output.push_back(unsigned(X >> 40) & 255);
- Output.push_back(unsigned(X >> 48) & 255);
- Output.push_back(unsigned(X >> 56) & 255);
- } else {
- Output.push_back(unsigned(X >> 56) & 255);
- Output.push_back(unsigned(X >> 48) & 255);
- Output.push_back(unsigned(X >> 40) & 255);
- Output.push_back(unsigned(X >> 32) & 255);
- Output.push_back(unsigned(X >> 24) & 255);
- Output.push_back(unsigned(X >> 16) & 255);
- Output.push_back(unsigned(X >> 8) & 255);
- Output.push_back(unsigned(X >> 0) & 255);
- }
- }
- virtual void outaddr32(DataBuffer &Output, unsigned X) const {
- outword(Output, X);
- }
- virtual void outaddr64(DataBuffer &Output, uint64_t X) const {
- outxword(Output, X);
- }
- virtual void outaddr(DataBuffer &Output, uint64_t X) const {
- if (!is64Bit)
- outword(Output, (unsigned)X);
- else
- outxword(Output, X);
- }
- virtual void outstring(DataBuffer &Output, std::string &S,
- unsigned Length) const {
- unsigned len_to_copy = S.length() < Length ? S.length() : Length;
- unsigned len_to_fill = S.length() < Length ? Length-S.length() : 0;
-
- for (unsigned i = 0; i < len_to_copy; ++i)
- outbyte(Output, S[i]);
-
- for (unsigned i = 0; i < len_to_fill; ++i)
- outbyte(Output, 0);
- }
-
- //===------------------------------------------------------------------===//
- // Fix Functions - Replace an existing entry at an offset.
-
- virtual void fixhalf(DataBuffer &Output, unsigned short X,
- unsigned Offset) const {
- unsigned char *P = &Output[Offset];
- P[0] = (X >> (isLittleEndian ? 0 : 8)) & 255;
- P[1] = (X >> (isLittleEndian ? 8 : 0)) & 255;
- }
- virtual void fixword(DataBuffer &Output, unsigned X,
- unsigned Offset) const {
- unsigned char *P = &Output[Offset];
- P[0] = (X >> (isLittleEndian ? 0 : 24)) & 255;
- P[1] = (X >> (isLittleEndian ? 8 : 16)) & 255;
- P[2] = (X >> (isLittleEndian ? 16 : 8)) & 255;
- P[3] = (X >> (isLittleEndian ? 24 : 0)) & 255;
- }
- virtual void fixaddr(DataBuffer &Output, uint64_t X,
- unsigned Offset) const {
- // Not implemented
- }
- private:
- /// Target machine description.
- const TargetMachine &TM;
-
- /// is64Bit/isLittleEndian - This information is inferred from the target
- /// machine directly, indicating what header values and flags to set.
- bool is64Bit, isLittleEndian;
- };
-
-} // end llvm namespace
-
-#endif // PPCTARGETOBJINFO_H
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index e446b61c4e4..7547614a717 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -13,7 +13,6 @@
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetObjInfo.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
@@ -105,7 +104,6 @@ namespace {
TargetMachine::~TargetMachine() {
delete AsmInfo;
- delete ObjInfo;
}
/// getRelocationModel - Returns the code generation relocation model. The
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index 194a6778154..8bcda9a290b 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "X86TargetAsmInfo.h"
-#include "X86TargetObjInfo.h"
#include "X86TargetMachine.h"
#include "X86.h"
#include "llvm/Module.h"
@@ -43,10 +42,6 @@ const TargetAsmInfo *X86TargetMachine::createTargetAsmInfo() const {
return new X86TargetAsmInfo(*this);
}
-const TargetObjInfo *X86TargetMachine::createTargetObjInfo() const {
- return new ELFTargetObjInfo(*this);
-}
-
unsigned X86_32TargetMachine::getJITMatchQuality() {
#if defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
return 10;
diff --git a/llvm/lib/Target/X86/X86TargetMachine.h b/llvm/lib/Target/X86/X86TargetMachine.h
index 64ddab561c4..05cb9484d63 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.h
+++ b/llvm/lib/Target/X86/X86TargetMachine.h
@@ -35,7 +35,6 @@ class X86TargetMachine : public LLVMTargetMachine {
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
- virtual const TargetObjInfo *createTargetObjInfo() const;
public:
X86TargetMachine(const Module &M, const std::string &FS, bool is64Bit);
diff --git a/llvm/lib/Target/X86/X86TargetObjInfo.cpp b/llvm/lib/Target/X86/X86TargetObjInfo.cpp
deleted file mode 100644
index 4333a402f9b..00000000000
--- a/llvm/lib/Target/X86/X86TargetObjInfo.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===-- X86TargetObjInfo.cpp - Object File Info ----------------------------==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Bill Wendling and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines target object file properties for X86
-//
-//===----------------------------------------------------------------------===//
-
-#include "X86TargetObjInfo.h"
-#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetMachine.h"
-using namespace llvm;
-
-ELFTargetObjInfo::ELFTargetObjInfo(const TargetMachine &tm)
- : TM(tm),
- is64Bit(TM.getTargetData()->getPointerSizeInBits() == 64),
- isLittleEndian(TM.getTargetData()->isLittleEndian()) {}
diff --git a/llvm/lib/Target/X86/X86TargetObjInfo.h b/llvm/lib/Target/X86/X86TargetObjInfo.h
deleted file mode 100644
index 57580ea0249..00000000000
--- a/llvm/lib/Target/X86/X86TargetObjInfo.h
+++ /dev/null
@@ -1,141 +0,0 @@
-//===-- X86TargetObjInfo.h - Object File Info --------------------*- C++ -*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Bill Wendling and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines target object file properties for X86
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef X86TARGETOBJINFO_H
-#define X86TARGETOBJINFO_H
-
-#include "llvm/Target/TargetObjInfo.h"
-
-namespace llvm {
-
- class TargetMachine;
-
- struct ELFTargetObjInfo : public TargetObjInfo {
- ELFTargetObjInfo(const TargetMachine &tm);
-
- // align - Emit padding into the file until the current output position is
- // aligned to the specified power of two boundary.
- virtual void align(DataBuffer &Output, unsigned Boundary) const {
- assert(Boundary && (Boundary & (Boundary - 1)) == 0 &&
- "Must align to 2^k boundary");
- size_t Size = Output.size();
-
- if (Size & (Boundary - 1)) {
- // Add padding to get alignment to the correct place.
- size_t Pad = Boundary - (Size & (Boundary - 1));
- Output.resize(Size + Pad);
- }
- }
-
- //===------------------------------------------------------------------===//
- // Out Functions - Output the specified value to the data buffer.
-
- virtual void outbyte(DataBuffer &Output, unsigned char X) const {
- Output.push_back(X);
- }
- virtual void outhalf(DataBuffer &Output, unsigned short X) const {
- if (isLittleEndian) {
- Output.push_back(X & 255);
- Output.push_back(X >> 8);
- } else {
- Output.push_back(X >> 8);
- Output.push_back(X & 255);
- }
- }
- virtual void outword(DataBuffer &Output, unsigned X) const {
- if (isLittleEndian) {
- Output.push_back((X >> 0) & 255);
- Output.push_back((X >> 8) & 255);
- Output.push_back((X >> 16) & 255);
- Output.push_back((X >> 24) & 255);
- } else {
- Output.push_back((X >> 24) & 255);
- Output.push_back((X >> 16) & 255);
- Output.push_back((X >> 8) & 255);
- Output.push_back((X >> 0) & 255);
- }
- }
- virtual void outxword(DataBuffer &Output, uint64_t X) const {
- if (isLittleEndian) {
- Output.push_back(unsigned(X >> 0) & 255);
- Output.push_back(unsigned(X >> 8) & 255);
- Output.push_back(unsigned(X >> 16) & 255);
- Output.push_back(unsigned(X >> 24) & 255);
- Output.push_back(unsigned(X >> 32) & 255);
- Output.push_back(unsigned(X >> 40) & 255);
- Output.push_back(unsigned(X >> 48) & 255);
- Output.push_back(unsigned(X >> 56) & 255);
- } else {
- Output.push_back(unsigned(X >> 56) & 255);
- Output.push_back(unsigned(X >> 48) & 255);
- Output.push_back(unsigned(X >> 40) & 255);
- Output.push_back(unsigned(X >> 32) & 255);
- Output.push_back(unsigned(X >> 24) & 255);
- Output.push_back(unsigned(X >> 16) & 255);
- Output.push_back(unsigned(X >> 8) & 255);
- Output.push_back(unsigned(X >> 0) & 255);
- }
- }
- virtual void outaddr32(DataBuffer &Output, unsigned X) const {
- outword(Output, X);
- }
- virtual void outaddr64(DataBuffer &Output, uint64_t X) const {
- outxword(Output, X);
- }
- virtual void outaddr(DataBuffer &Output, uint64_t X) const {
- if (!is64Bit)
- outword(Output, (unsigned)X);
- else
- outxword(Output, X);
- }
- virtual void outstring(DataBuffer &Output, std::string &S,
- unsigned Length) const {
- // Not implemented
- }
-
- //===------------------------------------------------------------------===//
- // Fix Functions - Replace an existing entry at an offset.
-
- virtual void fixhalf(DataBuffer &Output, unsigned short X,
- unsigned Offset) const {
- unsigned char *P = &Output[Offset];
- P[0] = (X >> (isLittleEndian ? 0 : 8)) & 255;
- P[1] = (X >> (isLittleEndian ? 8 : 0)) & 255;
- }
- virtual void fixword(DataBuffer &Output, unsigned X,
- unsigned Offset) const {
- unsigned char *P = &Output[Offset];
- P[0] = (X >> (isLittleEndian ? 0 : 24)) & 255;
- P[1] = (X >> (isLittleEndian ? 8 : 16)) & 255;
- P[2] = (X >> (isLittleEndian ? 16 : 8)) & 255;
- P[3] = (X >> (isLittleEndian ? 24 : 0)) & 255;
- }
- virtual void fixaddr(DataBuffer &Output, uint64_t X,
- unsigned Offset) const {
- if (!is64Bit)
- fixword(Output, (unsigned)X, Offset);
- else
- assert(0 && "Emission of 64-bit data not implemented yet!");
- }
- private:
- /// Target machine description.
- const TargetMachine &TM;
-
- /// is64Bit/isLittleEndian - This information is inferred from the target
- /// machine directly, indicating what header values and flags to set.
- bool is64Bit, isLittleEndian;
- };
-
-} // end llvm namespace
-
-#endif // X86TARGETOBJINFO_H
OpenPOWER on IntegriCloud