On Sun, Sep 2, 2012 at 1:02 PM, Peter Bigot <big...@acm.org> wrote:
> 1) The solution mentioned before and made explicit below, which is not
> optimal but does appear to meet your stated requirements for
> atomicity;

Right, I have been investigating that solution, and it's not 100%
reliable. Depending on what the branch structure looks like, the
compiler can sometimes insert a jump which destroys the peephole
optimization. For example:

    if (blah)
      flags |= some_bit;
    else
      flags &= ~some_bit;

This sometimes compiles to:

    TST.B   blah
    MOV.B   &flags, R14
    JZ      else
    BIS.B   #0x0008, R14
    JMP     skip
else:
    AND.B   #0x00f7, R14
skip:
    MOV.B   R14,     &flags

I can't just "set it and forget it" with option 1; I have to verify
that the assembly matches my intent, and re-verify it each time I
change something. Option 3 would be more work than option 2, but would
solve this problem once and for all for everyone.

-William

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to