<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">I would like to insert a Mips specific directive directly after every inline asm block. I have done this by exposing AsmPrinter::EmitInlineAsm() and making a Mips derivation that
calls the parent and then inserts the directive. I'm open to other ideas, but this seemed to be the most straight forward.<br>
<br>
May I check it in?<br>
<br>
Background:<br>
<br>
The Mips assembler has been around before the compiler could handle things like delay slot filling. So, the assembler would move instructions around to create and fill the delayslot. The general sequence would look like this:<br>
<br>
.set reorder<br>
add inst<br>
load inst<br>
branch and link inst <-- this instruction has a delay slot<br>
store inst <-- this instruction is suppose to execute after the branch and line returns<br>
load inst<br>
.set noreorder<br>
<br>
This would get transformed by the assembler as:<br>
<br>
add inst<br>
branch and link inst <-- this instruction has a delay slot<br>
load inst <-- the load now goes into the delay slot and is executed before the branch<br>
store inst<br>
load inst<br>
<br>
With modern compilers this isn't needed, but we are still saddled with the directive .set reorder which is the default state historically. I have encountered user code that looks like this:<br>
<br>
// The first word. Notice, no 'D'<br>
{asm (<br>
".set noreorder"<br>
"lw %0,%1;"<br>
".set reorder"<br>
: "=r" (i)<br>
: "m" (*(b+4))<br>
);}<br>
<br>
The .set reorder messes with our compiler generated jumps and branches.<br>
<br>
GCC gets around this by wrapping each and every branch and jump with .set noreorder/reorder pairs. A bit over the top.<br>
<br>
Thanks,<br>
<br>
Jack<br>
</div>
</body>
</html>