teak-llvm/llvm/lib/Target/Teak/MCTargetDesc/TeakELFStreamer.cpp
Gericom 3da44a85b7 Many bug fixes and improvements
Fixed invalid mpy instruction being generated
Fixed byte order of 32 bit values when emitted to the elf file
Support for addv/subv to modify 16 bit registers directly
Support for move 8bit immediate
Support for tst0 instruction
Support for directly adding p0 to an ab register after mpy
Support for 8 bit immediate multiply
Support for modr instruction
Support for post increase/decrement for loads and stores
Use copy instruction for a to a register moves
2020-07-28 16:42:11 +02:00

41 lines
1.3 KiB
C++

#include "TeakELFStreamer.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/Support/Casting.h"
using namespace llvm;
TeakELFStreamer::TeakELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter> Emitter)
: MCELFStreamer(Context, std::move(MAB), std::move(OW), std::move(Emitter))
{
}
void TeakELFStreamer::EmitIntValue(uint64_t Value, unsigned Size)
{
if (Size == 4)
{
char buf[4];
buf[0] = uint8_t((Value >> 16) & 0xFF);
buf[1] = uint8_t((Value >> 24) & 0xFF);
buf[2] = uint8_t(Value & 0xFF);
buf[3] = uint8_t((Value >> 8) & 0xFF);
EmitBytes(StringRef(buf, Size));
return;
}
MCELFStreamer::EmitIntValue(Value, Size);
}
MCELFStreamer* llvm::createTeakELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter> Emitter, bool RelaxAll)
{
return new TeakELFStreamer(Context, std::move(MAB), std::move(OW), std::move(Emitter));
}