mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-21 03:32:21 +00:00
Add MCELFObjectTargetWriter and MCAsmBackend classes.
Patch by Reed Kotler at Mips Technologies. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140885 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
90b6e346ee
commit
82ea7314ca
@ -1,4 +1,5 @@
|
|||||||
add_llvm_library(LLVMMipsDesc
|
add_llvm_library(LLVMMipsDesc
|
||||||
|
MipsAsmBackend.cpp
|
||||||
MipsMCAsmInfo.cpp
|
MipsMCAsmInfo.cpp
|
||||||
MipsMCCodeEmitter.cpp
|
MipsMCCodeEmitter.cpp
|
||||||
MipsMCTargetDesc.cpp
|
MipsMCTargetDesc.cpp
|
||||||
|
71
lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
Normal file
71
lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
#include "MCTargetDesc/MipsMCTargetDesc.h"
|
||||||
|
#include "llvm/ADT/Twine.h"
|
||||||
|
#include "llvm/MC/MCAssembler.h"
|
||||||
|
#include "llvm/MC/MCDirectives.h"
|
||||||
|
#include "llvm/MC/MCELFObjectWriter.h"
|
||||||
|
#include "llvm/MC/MCExpr.h"
|
||||||
|
#include "llvm/MC/MCMachObjectWriter.h"
|
||||||
|
#include "llvm/MC/MCObjectWriter.h"
|
||||||
|
#include "llvm/MC/MCSectionELF.h"
|
||||||
|
#include "llvm/MC/MCSectionMachO.h"
|
||||||
|
#include "llvm/MC/MCAsmBackend.h"
|
||||||
|
#include "llvm/MC/MCSubtargetInfo.h"
|
||||||
|
#include "llvm/Object/MachOFormat.h"
|
||||||
|
#include "llvm/Support/ELF.h"
|
||||||
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
using namespace llvm;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
class MipsELFObjectWriter : public MCELFObjectTargetWriter {
|
||||||
|
public:
|
||||||
|
MipsELFObjectWriter(bool is64Bit, Triple::OSType OSType, uint16_t EMachine,
|
||||||
|
bool HasRelocationAddend)
|
||||||
|
: MCELFObjectTargetWriter(is64Bit, OSType, EMachine,
|
||||||
|
HasRelocationAddend) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class MipsAsmBackend : public MCAsmBackend {
|
||||||
|
public:
|
||||||
|
MipsAsmBackend(const Target &T)
|
||||||
|
: MCAsmBackend() {}
|
||||||
|
|
||||||
|
unsigned getNumFixupKinds() const {
|
||||||
|
return 1; //tbd
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class MipsEB_AsmBackend : public MipsAsmBackend {
|
||||||
|
public:
|
||||||
|
Triple::OSType OSType;
|
||||||
|
|
||||||
|
MipsEB_AsmBackend(const Target &T, Triple::OSType _OSType)
|
||||||
|
: MipsAsmBackend(T), OSType(_OSType) {}
|
||||||
|
|
||||||
|
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
||||||
|
return createELFObjectWriter(createELFObjectTargetWriter(),
|
||||||
|
OS, /*IsLittleEndian*/ false);
|
||||||
|
}
|
||||||
|
|
||||||
|
MCELFObjectTargetWriter *createELFObjectTargetWriter() const {
|
||||||
|
return new MipsELFObjectWriter(false, OSType, ELF::EM_MIPS, false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class MipsEL_AsmBackend : public MipsAsmBackend {
|
||||||
|
public:
|
||||||
|
Triple::OSType OSType;
|
||||||
|
|
||||||
|
MipsEL_AsmBackend(const Target &T, Triple::OSType _OSType)
|
||||||
|
: MipsAsmBackend(T), OSType(_OSType) {}
|
||||||
|
|
||||||
|
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
||||||
|
return createELFObjectWriter(createELFObjectTargetWriter(),
|
||||||
|
OS, /*IsLittleEndian*/ true);
|
||||||
|
}
|
||||||
|
|
||||||
|
MCELFObjectTargetWriter *createELFObjectTargetWriter() const {
|
||||||
|
return new MipsELFObjectWriter(false, OSType, ELF::EM_MIPS, false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user