From d31203ae218637b8bb44824c9a7c63b1241fee8a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 4 Jun 2015 02:32:20 +0000 Subject: 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. llvm-svn: 239006 --- llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp | 2 +- llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp | 5 +---- llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp | 12 +++--------- 3 files changed, 5 insertions(+), 14 deletions(-) (limited to 'llvm/lib/Target/Mips') diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp index 82ae41330bc..982a7f54e82 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp @@ -384,7 +384,7 @@ bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym, return true; case ELF::R_MIPS_32: - if (cast(Sym).getOther() & (ELF::STO_MIPS_MICROMIPS >> 2)) + if (cast(Sym).getOther() & ELF::STO_MIPS_MICROMIPS) return true; // falltrough case ELF::R_MIPS_26: diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp index d1e3a47f94b..b45d9cf621d 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp @@ -44,10 +44,7 @@ void MipsELFStreamer::createPendingLabelRelocs() { for (auto *L : Labels) { auto *Label = cast(L); getAssembler().registerSymbol(*Label); - // The "other" values are stored in the last 6 bits of the second byte. - // The traditional defines for STO values assume the full byte and thus - // the shift to pack it. - Label->setOther(ELF::STO_MIPS_MICROMIPS >> 2); + Label->setOther(ELF::STO_MIPS_MICROMIPS); } } diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp index 787d9a7b450..a051f4c123f 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -462,10 +462,7 @@ void MipsTargetELFStreamer::emitLabel(MCSymbol *S) { if (Type != ELF::STT_FUNC) return; - // The "other" values are stored in the last 6 bits of the second byte - // The traditional defines for STO values assume the full byte and thus - // the shift to pack it. - Symbol->setOther(ELF::STO_MIPS_MICROMIPS >> 2); + Symbol->setOther(ELF::STO_MIPS_MICROMIPS); } void MipsTargetELFStreamer::finish() { @@ -527,13 +524,10 @@ void MipsTargetELFStreamer::emitAssignment(MCSymbol *S, const MCExpr *Value) { const auto &RhsSym = cast( static_cast(Value)->getSymbol()); - if (!(RhsSym.getOther() & (ELF::STO_MIPS_MICROMIPS >> 2))) + if (!(RhsSym.getOther() & ELF::STO_MIPS_MICROMIPS)) return; - // The "other" values are stored in the last 6 bits of the second byte. - // The traditional defines for STO values assume the full byte and thus - // the shift to pack it. - Symbol->setOther(ELF::STO_MIPS_MICROMIPS >> 2); + Symbol->setOther(ELF::STO_MIPS_MICROMIPS); } MCELFStreamer &MipsTargetELFStreamer::getStreamer() { -- cgit v1.2.3