Fix a low hanging use of hasRawTextSupport.

This also fixes the placement of the function label comment. It was being
placed next to the mips16 directive instead of next to the label.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199245 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-01-14 18:57:12 +00:00
parent 3e4542b2ca
commit 1c3e47c07a
16 changed files with 98 additions and 65 deletions

View File

@ -47,6 +47,18 @@ void MipsTargetAsmStreamer::emitDirectiveSetNoMicroMips() {
OS << "\t.set\tnomicromips\n";
}
void MipsTargetAsmStreamer::emitDirectiveSetMips16() {
OS << "\t.set\tmips16\n";
}
void MipsTargetAsmStreamer::emitDirectiveSetNoMips16() {
OS << "\t.set\tnomips16\n";
}
void MipsTargetAsmStreamer::emitDirectiveEnt(const MCSymbol &Symbol) {
OS << "\t.ent\t" << Symbol.getName() << '\n';
}
void MipsTargetAsmStreamer::emitDirectiveAbiCalls() { OS << "\t.abicalls\n"; }
void MipsTargetAsmStreamer::emitDirectiveOptionPic0() {
OS << "\t.option\tpic0\n";
@ -81,6 +93,18 @@ void MipsTargetELFStreamer::emitDirectiveSetNoMicroMips() {
MicroMipsEnabled = false;
}
void MipsTargetELFStreamer::emitDirectiveSetMips16() {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveSetNoMips16() {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveEnt(const MCSymbol &Symbol) {
// FIXME: implement.
}
void MipsTargetELFStreamer::emitDirectiveAbiCalls() {
MCAssembler &MCA = getStreamer().getAssembler();
unsigned Flags = MCA.getELFHeaderEFlags();

View File

@ -265,19 +265,19 @@ const char *MipsAsmPrinter::getCurrentABIString() const {
}
void MipsAsmPrinter::EmitFunctionEntryLabel() {
MipsTargetStreamer &TS = getTargetStreamer();
if (Subtarget->inMicroMipsMode())
getTargetStreamer().emitDirectiveSetMicroMips();
if (OutStreamer.hasRawTextSupport()) {
if (Subtarget->inMips16Mode())
OutStreamer.EmitRawText(StringRef("\t.set\tmips16"));
else
OutStreamer.EmitRawText(StringRef("\t.set\tnomips16"));
TS.emitDirectiveSetMicroMips();
// leave out until FSF available gas has micromips changes
// OutStreamer.EmitRawText(StringRef("\t.set\tnomicromips"));
OutStreamer.EmitRawText("\t.ent\t" + Twine(CurrentFnSym->getName()));
}
// else
// TS.emitDirectiveSetNoMicroMips();
if (Subtarget->inMips16Mode())
TS.emitDirectiveSetMips16();
else
TS.emitDirectiveSetNoMips16();
TS.emitDirectiveEnt(*CurrentFnSym);
OutStreamer.EmitLabel(CurrentFnSym);
}

View File

@ -21,6 +21,9 @@ public:
virtual void emitMipsHackELFFlags(unsigned Flags) = 0;
virtual void emitDirectiveSetMicroMips() = 0;
virtual void emitDirectiveSetNoMicroMips() = 0;
virtual void emitDirectiveSetMips16() = 0;
virtual void emitDirectiveSetNoMips16() = 0;
virtual void emitDirectiveEnt(const MCSymbol &Symbol) = 0;
virtual void emitDirectiveAbiCalls() = 0;
virtual void emitDirectiveOptionPic0() = 0;
};
@ -34,6 +37,9 @@ public:
virtual void emitMipsHackELFFlags(unsigned Flags);
virtual void emitDirectiveSetMicroMips();
virtual void emitDirectiveSetNoMicroMips();
virtual void emitDirectiveSetMips16();
virtual void emitDirectiveSetNoMips16();
virtual void emitDirectiveEnt(const MCSymbol &Symbol);
virtual void emitDirectiveAbiCalls();
virtual void emitDirectiveOptionPic0();
};
@ -52,6 +58,9 @@ public:
virtual void emitMipsHackELFFlags(unsigned Flags);
virtual void emitDirectiveSetMicroMips();
virtual void emitDirectiveSetNoMicroMips();
virtual void emitDirectiveSetMips16();
virtual void emitDirectiveSetNoMips16();
virtual void emitDirectiveEnt(const MCSymbol &Symbol);
virtual void emitDirectiveAbiCalls();
virtual void emitDirectiveOptionPic0();
};

View File

@ -10,7 +10,7 @@ entry:
ret float 1.000000e+00
}
; 32: .set nomips16 # @fv
; 32: .set nomips16
; 32: .ent fv
; 32: .set noreorder
; 32: .set nomacro
@ -26,7 +26,7 @@ entry:
ret double 2.000000e+00
}
; 32: .set nomips16 # @dv
; 32: .set nomips16
; 32: .ent dv
; 32: .set noreorder
; 32: .set nomacro
@ -44,7 +44,7 @@ entry:
ret void
}
; 32: .set nomips16 # @vf
; 32: .set nomips16
; 32: .ent vf
; 32: .set noreorder
; 32: .set nomacro
@ -62,7 +62,7 @@ entry:
ret void
}
; 32: .set nomips16 # @vd
; 32: .set nomips16
; 32: .ent vd
; 32: .set noreorder
; 32: .set nomacro
@ -83,7 +83,7 @@ entry:
ret void
}
; 32: .set nomips16 # @foo1
; 32: .set nomips16
; 32: .ent foo1
; 32: .set noreorder
; 32: .set nomacro
@ -102,7 +102,7 @@ entry:
}
; 32: .set nomips16 # @foo2
; 32: .set nomips16
; 32: .ent foo2
; 32: .set noreorder
; 32: .set nomacro
@ -120,7 +120,7 @@ entry:
ret void
}
; 32: .set nomips16 # @foo3
; 32: .set nomips16
; 32: .ent foo3
; 32: .set noreorder
; 32: .set nomacro
@ -138,7 +138,7 @@ entry:
ret void
}
; 32: .set mips16 # @vv
; 32: .set mips16
; 32: .ent vv
; 32: save {{.+}}

View File

@ -10,7 +10,7 @@ entry:
ret void
}
; 32: .set mips16 # @vv
; 32: .set mips16
; 32: .ent vv
; 32: save {{.+}}
@ -23,7 +23,7 @@ entry:
ret i32 %0
}
; 32: .set mips16 # @iv
; 32: .set mips16
; 32: .ent iv
; 32: save {{.+}}
@ -39,7 +39,7 @@ entry:
ret void
}
; 32: .set mips16 # @vif
; 32: .set mips16
; 32: .ent vif
; 32: save {{.+}}
@ -52,7 +52,7 @@ entry:
ret void
}
; 32: .set mips16 # @foo
; 32: .set mips16
; 32: .ent foo
; 32: save {{.+}}
@ -69,7 +69,7 @@ entry:
ret float 1.000000e+00
}
; 32: .set nomips16 # @fv
; 32: .set nomips16
; 32: .ent fv
; 32: .set noreorder
; 32: .set nomacro

View File

@ -15,7 +15,7 @@ entry:
%call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([13 x i8]* @.str, i32 0, i32 0))
ret i32 0
; SR: .set mips16 # @main
; SR: .set mips16
; SR32: .set nomips16
; SR32: .ent main

View File

@ -6,7 +6,7 @@ entry:
ret void
}
; CHECK: .set mips16 # @foo
; CHECK: .set mips16
; CHECK: .ent foo
; CHECK: jrc $ra
; CHECK: .end foo

View File

@ -4,7 +4,7 @@ define void @foo() #0 {
entry:
ret void
}
; 16: .set nomips16 # @foo
; 16: .set nomips16
; 16: .ent foo
; 16: .set noreorder
; 16: .set nomacro
@ -21,7 +21,7 @@ entry:
ret void
}
; 16: .set mips16 # @nofoo
; 16: .set mips16
; 16: .ent nofoo
; 16: jrc $ra
@ -32,7 +32,7 @@ entry:
ret i32 0
}
; 16: .set nomips16 # @main
; 16: .set nomips16
; 16: .ent main
; 16: .set noreorder
; 16: .set nomacro

View File

@ -6,11 +6,11 @@ entry:
ret void
}
; 16: .set mips16 # @foo
; 16: .set mips16
; 16: .ent foo
; 16: jrc $ra
; 16: .end foo
; 32: .set mips16 # @foo
; 32: .set mips16
; 32: .ent foo
; 32: jrc $ra
; 32: .end foo
@ -19,7 +19,7 @@ entry:
ret void
}
; 16: .set nomips16 # @nofoo
; 16: .set nomips16
; 16: .ent nofoo
; 16: .set noreorder
; 16: .set nomacro
@ -30,7 +30,7 @@ entry:
; 16: .set macro
; 16: .set reorder
; 16: .end nofoo
; 32: .set nomips16 # @nofoo
; 32: .set nomips16
; 32: .ent nofoo
; 32: .set noreorder
; 32: .set nomacro
@ -46,11 +46,11 @@ entry:
ret i32 0
}
; 16: .set mips16 # @main
; 16: .set mips16
; 16: .ent main
; 16: jrc $ra
; 16: .end main
; 32: .set nomips16 # @main
; 32: .set nomips16
; 32: .ent main
; 32: .set noreorder
; 32: .set nomacro

View File

@ -6,11 +6,11 @@ entry:
ret void
}
; 16: .set mips16 # @foo
; 16: .set mips16
; 16: .ent foo
; 16: jrc $ra
; 16: .end foo
; 32: .set mips16 # @foo
; 32: .set mips16
; 32: .ent foo
; 32: jrc $ra
; 32: .end foo
@ -19,7 +19,7 @@ entry:
ret void
}
; 16: .set nomips16 # @nofoo
; 16: .set nomips16
; 16: .ent nofoo
; 16: .set noreorder
; 16: .set nomacro
@ -30,7 +30,7 @@ entry:
; 16: .set macro
; 16: .set reorder
; 16: .end nofoo
; 32: .set nomips16 # @nofoo
; 32: .set nomips16
; 32: .ent nofoo
; 32: .set noreorder
; 32: .set nomacro
@ -46,11 +46,11 @@ entry:
ret i32 0
}
; 16: .set mips16 # @main
; 16: .set mips16
; 16: .ent main
; 16: jrc $ra
; 16: .end main
; 32: .set mips16 # @main
; 32: .set mips16
; 32: .ent main
; 32: jrc $ra
; 32: .end main

View File

@ -6,11 +6,11 @@ entry:
ret void
}
; 16: .set mips16 # @foo
; 16: .set mips16
; 16: .ent foo
; 16: jrc $ra
; 16: .end foo
; 32: .set mips16 # @foo
; 32: .set mips16
; 32: .ent foo
; 32: jrc $ra
; 32: .end foo
@ -19,7 +19,7 @@ entry:
ret void
}
; 16: .set nomips16 # @nofoo
; 16: .set nomips16
; 16: .ent nofoo
; 16: .set noreorder
; 16: .set nomacro
@ -30,7 +30,7 @@ entry:
; 16: .set macro
; 16: .set reorder
; 16: .end nofoo
; 32: .set nomips16 # @nofoo
; 32: .set nomips16
; 32: .ent nofoo
; 32: .set noreorder
; 32: .set nomacro
@ -46,7 +46,7 @@ entry:
ret i32 0
}
; 16: .set nomips16 # @main
; 16: .set nomips16
; 16: .ent main
; 16: .set noreorder
; 16: .set nomacro
@ -58,7 +58,7 @@ entry:
; 16: .set reorder
; 16: .end main
; 32: .set nomips16 # @main
; 32: .set nomips16
; 32: .ent main
; 32: .set noreorder
; 32: .set nomacro

View File

@ -6,11 +6,11 @@ entry:
ret void
}
; 16: .set mips16 # @foo
; 16: .set mips16
; 16: .ent foo
; 16: jrc $ra
; 16: .end foo
; 32: .set nomips16 # @foo
; 32: .set nomips16
; 32: .ent foo
; 32: .set noreorder
; 32: .set nomacro
@ -26,7 +26,7 @@ entry:
ret void
}
; 16: .set nomips16 # @nofoo
; 16: .set nomips16
; 16: .ent nofoo
; 16: .set noreorder
; 16: .set nomacro
@ -37,7 +37,7 @@ entry:
; 16: .set macro
; 16: .set reorder
; 16: .end nofoo
; 32: .set nomips16 # @nofoo
; 32: .set nomips16
; 32: .ent nofoo
; 32: .set noreorder
; 32: .set nomacro
@ -53,7 +53,7 @@ entry:
ret i32 0
}
; 16: .set nomips16 # @main
; 16: .set nomips16
; 16: .ent main
; 16: .set noreorder
; 16: .set nomacro
@ -65,7 +65,7 @@ entry:
; 16: .set reorder
; 16: .end main
; 32: .set nomips16 # @main
; 32: .set nomips16
; 32: .ent main
; 32: .set noreorder
; 32: .set nomacro

View File

@ -6,11 +6,11 @@ entry:
ret void
}
; 16: .set mips16 # @foo
; 16: .set mips16
; 16: .ent foo
; 16: jrc $ra
; 16: .end foo
; 32: .set nomips16 # @foo
; 32: .set nomips16
; 32: .ent foo
; 32: .set noreorder
; 32: .set nomacro
@ -26,7 +26,7 @@ entry:
ret void
}
; 16: .set nomips16 # @nofoo
; 16: .set nomips16
; 16: .ent nofoo
; 16: .set noreorder
; 16: .set nomacro
@ -37,7 +37,7 @@ entry:
; 16: .set macro
; 16: .set reorder
; 16: .end nofoo
; 32: .set nomips16 # @nofoo
; 32: .set nomips16
; 32: .ent nofoo
; 32: .set noreorder
; 32: .set nomacro
@ -53,12 +53,12 @@ entry:
ret i32 0
}
; 16: .set mips16 # @main
; 16: .set mips16
; 16: .ent main
; 16: jrc $ra
; 16: .end main
; 32: .set mips16 # @main
; 32: .set mips16
; 32: .ent main
; 32: jrc $ra
; 32: .end main

View File

@ -14,7 +14,7 @@ entry:
ret void
}
; 32: .set mips16 # @foo
; 32: .set mips16
; 32: .ent foo
; 32: jrc $ra
; 32: .end foo
@ -32,7 +32,7 @@ entry:
ret void
}
; 32: .set nomips16 # @nofoo
; 32: .set nomips16
; 32: .ent nofoo
; 32: .set noreorder
; 32: .set nomacro
@ -56,7 +56,7 @@ entry:
ret i32 0
}
; 32: .set nomips16 # @main
; 32: .set nomips16
; 32: .ent main
; 32: .set noreorder
; 32: .set nomacro

View File

@ -5,7 +5,7 @@ entry:
ret void
}
; 32: .set mips16 # @foo
; 32: .set mips16
; 32: .ent foo
; 32: jrc $ra
; 32: .end foo
@ -14,7 +14,7 @@ entry:
ret void
}
; 32: .set nomips16 # @nofoo
; 32: .set nomips16
; 32: .ent nofoo
; 32: .set noreorder
; 32: .set nomacro
@ -30,7 +30,7 @@ entry:
ret i32 0
}
; 32: .set mips16 # @main
; 32: .set mips16
; 32: .ent main
; 32: jrc $ra
; 32: .end main

View File

@ -5,7 +5,7 @@ define i32 @main() nounwind {
entry:
ret i32 0
; 16: .set mips16 # @main
; 16: .set mips16
; 16: jrc $ra