diff --git a/lib/Target/Mips/MipsAsmPrinter.cpp b/lib/Target/Mips/MipsAsmPrinter.cpp index 94b7c0d9807..fac3f79491b 100644 --- a/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/MipsAsmPrinter.cpp @@ -725,6 +725,12 @@ void MipsAsmPrinter::emitInlineAsmStart( const MCSubtargetInfo &StartInfo) const { MipsTargetStreamer &TS = getTargetStreamer(); + // GCC's choice of assembler options for inline assembly code ('at', 'macro' + // and 'reorder') is different from LLVM's choice for generated code ('noat', + // 'nomacro' and 'noreorder'). + // In order to maintain compatibility with inline assembly code which depends + // on GCC's assembler options being used, we have to switch to those options + // for the duration of the inline assembly block and then switch back. TS.emitDirectiveSetPush(); TS.emitDirectiveSetAt(); TS.emitDirectiveSetMacro();