[llvm] r175564 - ELF symbol table field st_other support,
David Blaikie
dblaikie at gmail.com
Tue Feb 19 23:42:49 PST 2013
On Tue, Feb 19, 2013 at 2:04 PM, Jack Carter <jcarter at mips.com> wrote:
> Author: jacksprat
> Date: Tue Feb 19 16:04:37 2013
> New Revision: 175564
>
> URL: http://llvm.org/viewvc/llvm-project?rev=175564&view=rev
> Log:
> ELF symbol table field st_other support,
> excluding visibility bits.
>
> Mips (MicroMips) specific STO handling .
>
> The st_other field settig for STO_MIPS_MICROMIPS
>
> Contributer: Zoran Jovanovic
>
>
>
> Modified:
> llvm/trunk/include/llvm/Support/ELF.h
> llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
> llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h
> llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
> llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
>
> Modified: llvm/trunk/include/llvm/Support/ELF.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ELF.h?rev=175564&r1=175563&r2=175564&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/ELF.h (original)
> +++ llvm/trunk/include/llvm/Support/ELF.h Tue Feb 19 16:04:37 2013
> @@ -738,6 +738,10 @@ enum {
> EF_MIPS_NOREORDER = 0x00000001, // Don't reorder instructions
> EF_MIPS_PIC = 0x00000002, // Position independent code
> EF_MIPS_CPIC = 0x00000004, // Call object with Position
> independent code
> + //ARCH_ASE
> + EF_MIPS_MICROMIPS = 0x02000000, // microMIPS
> + //ARCH
> + EF_MIPS_ARCH = 0xf0000000, // Mask for applying EF_MIPS_ARCH_
> variant
> EF_MIPS_ARCH_1 = 0x00000000, // MIPS1 instruction set
> EF_MIPS_ARCH_2 = 0x10000000, // MIPS2 instruction set
> EF_MIPS_ARCH_3 = 0x20000000, // MIPS3 instruction set
> @@ -746,9 +750,7 @@ enum {
> EF_MIPS_ARCH_32 = 0x50000000, // MIPS32 instruction set per linux not
> elf.h
> EF_MIPS_ARCH_64 = 0x60000000, // MIPS64 instruction set per linux not
> elf.h
> EF_MIPS_ARCH_32R2 = 0x70000000, // mips32r2
> - EF_MIPS_ARCH_64R2 = 0x80000000, // mips64r2
> - EF_MIPS_ARCH = 0xf0000000, // Mask for applying EF_MIPS_ARCH_
> variant
> - EF_MIPS_MICROMIPS = 0x02000000 // microMIPS
> + EF_MIPS_ARCH_64R2 = 0x80000000 // mips64r2
> };
>
> // ELF Relocation types for Mips
> @@ -809,6 +811,11 @@ enum {
> R_MIPS_NUM = 218
> };
>
> +// Special values for the st_other field in the symbol table entry for
> MIPS.
> +enum {
> + STO_MIPS_MICROMIPS = 0x80 // MIPS Specific ISA for MicroMips
> +};
> +
> // Hexagon Specific e_flags
> // Release 5 ABI
> enum {
>
> Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp?rev=175564&r1=175563&r2=175564&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp (original)
> +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp Tue Feb 19
> 16:04:37 2013
> @@ -9,6 +9,9 @@
> #include "MCTargetDesc/MipsELFStreamer.h"
> #include "MipsSubtarget.h"
> #include "llvm/MC/MCAssembler.h"
> +#include "llvm/MC/MCELF.h"
> +#include "llvm/MC/MCELFSymbolFlags.h"
> +#include "llvm/MC/MCSymbol.h"
> #include "llvm/Support/ELF.h"
> #include "llvm/Support/ErrorHandling.h"
>
> @@ -58,7 +61,22 @@ namespace llvm {
> llvm_unreachable("Unsupported relocation model for e_flags");
>
> MCA.setELFHeaderEFlags(EFlags);
> + }
> +
> + // For llc. Set a symbol's STO flags
> + void
> + MipsELFStreamer::emitMipsSTOCG(const MipsSubtarget &Subtarget,
> + MCSymbol *Sym,
> + unsigned Val) {
>
> + if (hasRawTextSupport())
> + return;
>
> + MCSymbolData &Data = getOrCreateSymbolData(Sym);
> + // 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.
> + MCELF::setOther(Data, Val >> 2);
> }
> -}
> +
> +} // namespace llvm
>
> Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h?rev=175564&r1=175563&r2=175564&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h (original)
> +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h Tue Feb 19
> 16:04:37 2013
> @@ -12,7 +12,9 @@
> #include "llvm/MC/MCELFStreamer.h"
>
> namespace llvm {
> +class MipsAsmPrinter;
> class MipsSubtarget;
> +class MCSymbol;
>
> class MipsELFStreamer : public MCELFStreamer {
> public:
> @@ -24,7 +26,9 @@ public:
>
> ~MipsELFStreamer() {}
> void emitELFHeaderFlagsCG(const MipsSubtarget &Subtarget);
> -// void emitELFHeaderFlagCG(unsigned Val);
> + void emitMipsSTOCG(const MipsSubtarget &Subtarget,
> + MCSymbol *Sym,
> + unsigned Val);
>
> static bool classof(const MCStreamer *S) {
> return S->getKind() == SK_MipsELFStreamer;
>
> Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp?rev=175564&r1=175563&r2=175564&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
> (original)
> +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp Tue Feb
> 19 16:04:37 2013
> @@ -35,11 +35,13 @@ class MipsMCCodeEmitter : public MCCodeE
> void operator=(const MipsMCCodeEmitter &) LLVM_DELETED_FUNCTION;
> const MCInstrInfo &MCII;
> MCContext &Ctx;
> + const MCSubtargetInfo &STI;
>
This member variable is unused & breaks the clang -Werror build. I removed
it in r175607.
- David
> bool IsLittleEndian;
>
> public:
> - MipsMCCodeEmitter(const MCInstrInfo &mcii, MCContext &Ctx_, bool
> IsLittle) :
> - MCII(mcii), Ctx(Ctx_), IsLittleEndian(IsLittle) {}
> + MipsMCCodeEmitter(const MCInstrInfo &mcii, MCContext &Ctx_,
> + const MCSubtargetInfo &sti, bool IsLittle) :
> + MCII(mcii), Ctx(Ctx_), STI (sti), IsLittleEndian(IsLittle) {}
>
> ~MipsMCCodeEmitter() {}
>
> @@ -95,7 +97,7 @@ MCCodeEmitter *llvm::createMipsMCCodeEmi
> const MCSubtargetInfo &STI,
> MCContext &Ctx)
> {
> - return new MipsMCCodeEmitter(MCII, Ctx, false);
> + return new MipsMCCodeEmitter(MCII, Ctx, STI, false);
> }
>
> MCCodeEmitter *llvm::createMipsMCCodeEmitterEL(const MCInstrInfo &MCII,
> @@ -103,7 +105,7 @@ MCCodeEmitter *llvm::createMipsMCCodeEmi
> const MCSubtargetInfo &STI,
> MCContext &Ctx)
> {
> - return new MipsMCCodeEmitter(MCII, Ctx, true);
> + return new MipsMCCodeEmitter(MCII, Ctx, STI, true);
> }
>
> /// EncodeInstruction - Emit the instruction.
>
> Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=175564&r1=175563&r2=175564&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original)
> +++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Tue Feb 19 16:04:37 2013
> @@ -36,6 +36,7 @@
> #include "llvm/MC/MCInst.h"
> #include "llvm/MC/MCStreamer.h"
> #include "llvm/MC/MCSymbol.h"
> +#include "llvm/Support/ELF.h"
> #include "llvm/Support/TargetRegistry.h"
> #include "llvm/Support/raw_ostream.h"
> #include "llvm/Target/Mangler.h"
> @@ -231,6 +232,11 @@ void MipsAsmPrinter::EmitFunctionEntryLa
> // OutStreamer.EmitRawText(StringRef("\t.set\tnomicromips"));
> OutStreamer.EmitRawText("\t.ent\t" + Twine(CurrentFnSym->getName()));
> }
> +
> + if (Subtarget->inMicroMipsMode())
> + if (MipsELFStreamer *MES = dyn_cast<MipsELFStreamer>(&OutStreamer))
> + MES->emitMipsSTOCG(*Subtarget, CurrentFnSym,
> + (unsigned)ELF::STO_MIPS_MICROMIPS);
> OutStreamer.EmitLabel(CurrentFnSym);
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130219/a26d7e76/attachment.html>
More information about the llvm-commits
mailing list