[llvm-commits] [llvm] r167040 - in /llvm/trunk: include/llvm/CodeGen/MachineInstr.h include/llvm/InlineAsm.h lib/CodeGen/MachineVerifier.cpp lib/CodeGen/ScheduleDAGInstrs.cpp lib/CodeGen/SelectionDAG/InstrEmitter.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Oct 30 13:12:16 PDT 2012


On Oct 30, 2012, at 12:11 PM, Chad Rosier <mcrosier at apple.com> wrote:

> Author: mcrosier
> Date: Tue Oct 30 14:11:54 2012
> New Revision: 167040
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=167040&view=rev
> Log:
> [inline asm] Implement mayLoad and mayStore for inline assembly.  In general,
> the MachineInstr MayLoad/MayLoad flags are based on the tablegen implementation.
> For inline assembly, however, we need to compute these based on the constraints.
> 
> Revert r166929 as this is no longer needed, but leave the test case in place. 
> rdar://12033048 and PR13504
> 
> Modified:
>    llvm/trunk/include/llvm/CodeGen/MachineInstr.h
>    llvm/trunk/include/llvm/InlineAsm.h
>    llvm/trunk/lib/CodeGen/MachineVerifier.cpp
>    llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp
>    llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
>    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> 
> Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=167040&r1=167039&r2=167040&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Tue Oct 30 14:11:54 2012
> @@ -58,8 +58,10 @@
>     NoFlags      = 0,
>     FrameSetup   = 1 << 0,              // Instruction is used as a part of
>                                         // function frame setup code.
> -    InsideBundle = 1 << 1               // Instruction is inside a bundle (not
> +    InsideBundle = 1 << 1,              // Instruction is inside a bundle (not
>                                         // the first MI in a bundle)
> +    MayLoad      = 1 << 2,              // Instruction could possibly read memory.
> +    MayStore     = 1 << 3               // Instruction could possibly modify memory.
>   };

Hi Chad,

Are there other instructions than inline asm that need dynamic mayLoad/mayStore flags?

If not, it seems you can just as easily get your flags from the INLINEASM flag operand (ExtraInfo):

--- llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Tue Oct 30 14:11:54 2012
@@ -903,6 +903,13 @@
                          getZExtValue();
    MI->addOperand(MachineOperand::CreateImm(ExtraInfo));

+    // Set the MayLoad and MayStore flags.
+    if (ExtraInfo & InlineAsm::Extra_MayLoad)
+      MI->setFlag(MachineInstr::MayLoad);
+
+    if (ExtraInfo & InlineAsm::Extra_MayStore)
+      MI->setFlag(MachineInstr::MayStore);
+
    // Remember to operand index of the group flags.
    SmallVector<unsigned, 8> GroupIdx;


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121030/733d8295/attachment.html>


More information about the llvm-commits mailing list