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