[PATCH] Inserting directives directly after inline asm blocks

Richard Sandiford rsandifo at linux.vnet.ibm.com
Tue Apr 23 04:14:17 PDT 2013


Jack Carter <Jack.Carter at imgtec.com> writes:
> I am going to pull this patch request. We may have to mimic GCC in the
> end due to historical customer code expectations.

Well, like you say, the interface is that asms start in ".set macro;
.set reorder" mode.  But I don't think it should matter whether you
do that by mimicing GCC (i.e. output functions that have asms in
reorder mode, and only wrap specific sequences in noreorder)
or whether you instead change the patch to:

void MipsAsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
  if (OutStreamer.hasRawTextSupport())
    if (!Subtarget->inMips16Mode())
      OutStreamer.EmitRawText(StringRef("\t.set\treorder"));
  AsmPrinter::EmitInlineAsm(MI);
  if (OutStreamer.hasRawTextSupport())
    if (!Subtarget->inMips16Mode())
      OutStreamer.EmitRawText(StringRef("\t.set\tnoreorder"));
}

GCC does it the way it does because there are other situations
in which functions must be reorder by default.  This includes
various -mfix- options, where the fixes are handled by the assembler,
and the legacy -mno-explicit-relocs mode.  It was just easier to
support only two modes -- the entire function being noreorder,
or the function being reorder with local noreorder spots --
rather than add a third (entire function being noreorder,
except for asms).

Richard




More information about the llvm-commits mailing list