[LLVMdev] emitting function stub for mips16 floating point patch

Daniel Sanders Daniel.Sanders at imgtec.com
Mon Feb 3 01:59:58 PST 2014


Hi Reed,

I think you need to look at:
* MCStreamer::SwitchSection() for .section.
* MipsTargetStreamer::emitDirectiveEnt() for .ent
* MCAsmStreamer::EmitSymbolAttribute() for .globl, and .type

I couldn't find a function for .end. I expect it's there but it's difficult to grep for because it clashes with iterators.

If there are any directives you need that aren't already supported, you'll need an emitX function for each directive in each of the MIPS target streamers. The one in MipsTargetStreamer should be abstract, the one in MipsAsmTargetStreamer should emit the assembly text, and the one in MipsELFTargetStreamer should do the appropriate thing in the ELF. For your purposes you could leave an llvm_unreachable("Not implemented") in the MipsELFTargetStreamer for now, but it would be great if you could implement that as well since someone will have to do it for the planned assembler anyway. If you do implement MipsELFTargetStreamer::emitX(), you will also need to implement the relevant AsmParser support so that you can test the directive (tests using llc -filetype=obj are not ok).
See MipsTargetStreamer::emitDirectiveSetMicroMips() for an example.

> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Reed Kotler
> Sent: 01 February 2014 00:04
> To: LLVMdev at cs.uiuc.edu
> Subject: Re: [LLVMdev] emitting function stub for mips16 floating point patch
> 
> On 01/31/2014 03:59 PM, reed kotler wrote:
> > I'm rewriting this patch for the stubs to not use outputing of raw text.
> >
> > Generating the instructions is very straightforward and that part is
> > done.
> >
> > I'm translating the actual function now.
> >
> > How do you emit an .ent or .globl from asm printer?
> > .type ?
> > .end ??
> > .section ???
> >
> > I'm studying the classes now but it should be simple to do so if you
> > know, you can save me some time because this is another maze of llvm
> > data abstraction.
> >
> > Tia.
> >
> > Reed
> >
> >
> >
> We already have this MIpsTargetStreamer class which seems like a place
> where this could be added.
> 
> Given the big storm around any kind of raw text I don't want to add to this if
> this is already something we are not supposed to be doing.
> 
> >
> >
> >
> > void MipsAsmPrinter::EmitFPCallStub(
> >   const char* Symbol, const Mips16HardFloatInfo::FuncSignature*
> > Signature) {
> >   OutStreamer.EmitRawText("\t.globl "+ Twine(Symbol)); .........
> >   OutStreamer.EmitRawText("\t# Stub function to call " + Twine(RetType) +
> >                           " " + Twine(Symbol) + " (" + Twine(Parms) +
> > ")");
> > OutStreamer.EmitRawText("\t.section\t.mips16.call.fp"+Twine(Symbol)+",
> > \"ax\", at progbits");
> >
> >   OutStreamer.EmitRawText(".align 2");
> >   OutStreamer.EmitRawText(".nomips16");
> >   OutStreamer.EmitRawText(".nomicromips");
> >   OutStreamer.EmitRawText("\t.ent\t__call_stub_fp_" + Twine(Symbol));
> >   OutStreamer.EmitRawText("\t.type\t__call_stub_fp_" + Twine(Symbol) +
> > ", @function");
> >   OutStreamer.EmitRawText("\t__call_stub_fp_" + Twine(Symbol) + ":");
> >   OutStreamer.EmitRawText("\t.size  __call_stub_fp_" + Twine(Symbol) +
> >                           ", .-__call_stub_fp_" + Twine(Symbol));
> >   OutStreamer.EmitRawText("\t.end  __call_stub_fp_" + Twine(Symbol))
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list