[llvm-commits] atomic operator patch

Dan Gohman gohman at apple.com
Fri May 2 15:10:02 PDT 2008


Hi Mon Ping,

This patch looks good to me. I just have a few minor comments.

In lib/Target/X86/X86ISelLowering.cpp:

+  // Move all successors to thisMBB to nextMBB
+  for(MachineBasicBlock::succ_iterator iter = thisMBB->succ_begin(),
+      end = thisMBB->succ_end(); iter != end; ++iter) {
+    nextMBB->addSuccessor(*iter);
+  }
+
+  // Update thisMBB to fall through to newMBB
+  while(!thisMBB->succ_empty())
+    thisMBB->removeSuccessor(thisMBB->succ_begin());

Transferring all the successors from one block to another is
a fairly common task. Could you add a utility routine to
MachineBasicBlock to do this?

+  // newBB jumps to itself and fall through to next bb
+  newMBB->addSuccessor(nextMBB);

Typo; the comment should say newMBB.

Thanks,

Dan

On May 2, 2008, at 11:58 AM, Mon P Wang wrote:

>
> Thanks for all the helpful comments. I have fixed and cleanup the  
> code for the atomic operator patch.  I have changed the code to use  
> cmpxchg and to loop if the value we read has been altered before the  
> write.  Please let me know if you have any further comments.
>
> Thanks,
>  -- Mon Ping
>
> <atomic_op.patch>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list