1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00
llvm-svn: 119462
This commit is contained in:
Chris Lattner 2010-11-17 05:41:32 +00:00
parent 7d3f3104d7
commit 4e53e6e198
2 changed files with 16 additions and 26 deletions

View File

@ -22,15 +22,12 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetAsmBackend.h"
using namespace llvm;
namespace {
class ARMAsmBackend : public TargetAsmBackend {
public:
ARMAsmBackend(const Target &T)
: TargetAsmBackend(T) {
}
ARMAsmBackend(const Target &T) : TargetAsmBackend(T) {}
bool MayNeedRelaxation(const MCInst &Inst) const;
@ -42,6 +39,7 @@ public:
return 4;
}
};
} // end anonymous namespace
bool ARMAsmBackend::MayNeedRelaxation(const MCInst &Inst) const {
// FIXME: Thumb targets, different move constant targets..
@ -64,7 +62,6 @@ bool ARMAsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const {
OW->Write8(0);
return true;
}
} // end anonymous namespace
namespace {
// FIXME: This should be in a separate file.
@ -105,13 +102,12 @@ void ELFARMAsmBackend::ApplyFixup(const MCFixup &Fixup, MCDataFragment &DF,
assert(0 && "ELFARMAsmBackend::ApplyFixup() unimplemented");
}
namespace {
// FIXME: This should be in a separate file.
class DarwinARMAsmBackend : public ARMAsmBackend {
MCMachOObjectFormat Format;
public:
DarwinARMAsmBackend(const Target &T)
: ARMAsmBackend(T) {
DarwinARMAsmBackend(const Target &T) : ARMAsmBackend(T) {
HasScatteredSymbols = true;
}
@ -140,6 +136,7 @@ public:
return false;
}
};
} // end anonymous namespace
static unsigned getFixupKindNumBytes(unsigned Kind) {
switch (Kind) {

View File

@ -34,13 +34,12 @@ static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
// This is duplicated code. Refactor this.
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
MCContext &Ctx, TargetAsmBackend &TAB,
raw_ostream &_OS,
MCCodeEmitter *_Emitter,
raw_ostream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll) {
Triple TheTriple(TT);
switch (TheTriple.getOS()) {
switch (Triple(TT).getOS()) {
case Triple::Darwin:
return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll);
return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
case Triple::MinGW32:
case Triple::MinGW64:
case Triple::Cygwin:
@ -48,7 +47,7 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
llvm_unreachable("ARM does not support Windows COFF format");
return NULL;
default:
return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll);
return createELFStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
}
}
@ -62,22 +61,16 @@ extern "C" void LLVMInitializeARMTarget() {
RegisterAsmInfoFn B(TheThumbTarget, createMCAsmInfo);
// Register the MC Code Emitter
TargetRegistry::RegisterCodeEmitter(TheARMTarget,
createARMMCCodeEmitter);
TargetRegistry::RegisterCodeEmitter(TheThumbTarget,
createARMMCCodeEmitter);
TargetRegistry::RegisterCodeEmitter(TheARMTarget, createARMMCCodeEmitter);
TargetRegistry::RegisterCodeEmitter(TheThumbTarget, createARMMCCodeEmitter);
// Register the asm backend.
TargetRegistry::RegisterAsmBackend(TheARMTarget,
createARMAsmBackend);
TargetRegistry::RegisterAsmBackend(TheThumbTarget,
createARMAsmBackend);
TargetRegistry::RegisterAsmBackend(TheARMTarget, createARMAsmBackend);
TargetRegistry::RegisterAsmBackend(TheThumbTarget, createARMAsmBackend);
// Register the object streamer.
TargetRegistry::RegisterObjectStreamer(TheARMTarget,
createMCStreamer);
TargetRegistry::RegisterObjectStreamer(TheThumbTarget,
createMCStreamer);
TargetRegistry::RegisterObjectStreamer(TheARMTarget, createMCStreamer);
TargetRegistry::RegisterObjectStreamer(TheThumbTarget, createMCStreamer);
}