mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
cddcabadf2
The fix is just that getOther had not been updated for packing the st_other values in fewer bits and could return spurious values: - unsigned Other = (getFlags() & (0x3f << ELF_STO_Shift)) >> ELF_STO_Shift; + unsigned Other = (getFlags() & (0x7 << ELF_STO_Shift)) >> ELF_STO_Shift; Original message: Pack the MCSymbolELF bit fields into MCSymbol's Flags. This reduces MCSymolfELF from 64 bytes to 56 bytes on x86_64. While at it, also make getOther/setOther easier to use by accepting unshifted STO_* values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239012 91177308-0d34-0410-b5e6-96231b3b80d8
83 lines
2.5 KiB
C++
83 lines
2.5 KiB
C++
//===-------- MipsELFStreamer.cpp - ELF Object Output ---------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "MipsELFStreamer.h"
|
|
#include "MipsTargetStreamer.h"
|
|
#include "llvm/MC/MCInst.h"
|
|
#include "llvm/MC/MCSymbolELF.h"
|
|
#include "llvm/Support/ELF.h"
|
|
|
|
using namespace llvm;
|
|
|
|
void MipsELFStreamer::EmitInstruction(const MCInst &Inst,
|
|
const MCSubtargetInfo &STI) {
|
|
MCELFStreamer::EmitInstruction(Inst, STI);
|
|
|
|
MCContext &Context = getContext();
|
|
const MCRegisterInfo *MCRegInfo = Context.getRegisterInfo();
|
|
|
|
for (unsigned OpIndex = 0; OpIndex < Inst.getNumOperands(); ++OpIndex) {
|
|
const MCOperand &Op = Inst.getOperand(OpIndex);
|
|
|
|
if (!Op.isReg())
|
|
continue;
|
|
|
|
unsigned Reg = Op.getReg();
|
|
RegInfoRecord->SetPhysRegUsed(Reg, MCRegInfo);
|
|
}
|
|
|
|
createPendingLabelRelocs();
|
|
}
|
|
|
|
void MipsELFStreamer::createPendingLabelRelocs() {
|
|
MipsTargetELFStreamer *ELFTargetStreamer =
|
|
static_cast<MipsTargetELFStreamer *>(getTargetStreamer());
|
|
|
|
// FIXME: Also mark labels when in MIPS16 mode.
|
|
if (ELFTargetStreamer->isMicroMipsEnabled()) {
|
|
for (auto *L : Labels) {
|
|
auto *Label = cast<MCSymbolELF>(L);
|
|
getAssembler().registerSymbol(*Label);
|
|
Label->setOther(ELF::STO_MIPS_MICROMIPS);
|
|
}
|
|
}
|
|
|
|
Labels.clear();
|
|
}
|
|
|
|
void MipsELFStreamer::EmitLabel(MCSymbol *Symbol) {
|
|
MCELFStreamer::EmitLabel(Symbol);
|
|
Labels.push_back(Symbol);
|
|
}
|
|
|
|
void MipsELFStreamer::SwitchSection(MCSection *Section,
|
|
const MCExpr *Subsection) {
|
|
MCELFStreamer::SwitchSection(Section, Subsection);
|
|
Labels.clear();
|
|
}
|
|
|
|
void MipsELFStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
|
const SMLoc &Loc) {
|
|
MCELFStreamer::EmitValueImpl(Value, Size, Loc);
|
|
Labels.clear();
|
|
}
|
|
|
|
void MipsELFStreamer::EmitMipsOptionRecords() {
|
|
for (const auto &I : MipsOptionRecords)
|
|
I->EmitMipsOptionRecord();
|
|
}
|
|
|
|
MCELFStreamer *llvm::createMipsELFStreamer(MCContext &Context,
|
|
MCAsmBackend &MAB,
|
|
raw_pwrite_stream &OS,
|
|
MCCodeEmitter *Emitter,
|
|
bool RelaxAll) {
|
|
return new MipsELFStreamer(Context, MAB, OS, Emitter);
|
|
}
|