[Ada] Implement AI05-117 (memory barriers and volatile objects)

Eric Botcazou ebotcazou@adacore.com
Thu Nov 10 20:10:00 GMT 2011


This is the final part of the implementation of AI05-117, whose aim is to make 
it possible to implement efficient lock-free algorithms.  We map operations on 
atomic types onto the new __builtin_atomic_load and __builtin_atomic_store 
primitives of the middle-end.

Tested on i586-suse-linux, applied on mainline,


2011-11-10  Eric Botcazou  <ebotcazou@adacore.com>

	* fe.h (Serious_Errors_Detected): New macro.
	* gcc-interface/gigi.h (build_atomic_load): Declare.
	(build_atomic_store): Likewise.
	* gcc-interface/trans.c (atomic_sync_required_p): New predicate.
	(call_to_gnu): Add ATOMIC_SYNC parameter.  Use local variable.
	Build an atomic load for an In or In Out parameter if needed.
	Build an atomic store for the assignment of an Out parameter if needed.
	Build an atomic store to the target if ATOMIC_SYNC is true.
	(present_in_lhs_or_actual_p): New predicate.
	(gnat_to_gnu) <N_Identifier>: Build an atomic load if needed.
	<N_Explicit_Dereference>: Likewise.
	<N_Indexed_Component>: Likewise.
	<N_Selected_Component>: Likewise.
	<N_Assignment_Statement>: Adjust call to call_to_gnu.
	Build an atomic store to the LHS if needed.
	<N_Function_Call>:  Adjust call to call_to_gnu.
	* gcc-interface/utils2.c: Include toplev.h.
	(resolve_atomic_size): New static function.
	(build_atomic_load): New function.
	(build_atomic_store): Likewise.
	* gcc-interface/Make-lang.in (ada/utils2.o): Add toplev.h.


2011-11-10  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/atomic6_1.adb: New test.
	* gnat.dg/atomic6_2.adb: Likewise.
	* gnat.dg/atomic6_3.adb: Likewise.
	* gnat.dg/atomic6_4.adb: Likewise.
	* gnat.dg/atomic6_5.adb: Likewise.
	* gnat.dg/atomic6_6.adb: Likewise.
	* gnat.dg/atomic6_7.adb: Likewise.
	* gnat.dg/atomic6_8.adb: Likewise.
	* gnat.dg/atomic6_pkg.ads: New helper.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ada_atomic.diff
Type: text/x-diff
Size: 16857 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111110/230f157e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic6_1.adb
Type: text/x-adasrc
Size: 1487 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111110/230f157e/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic6_3.adb
Type: text/x-adasrc
Size: 1775 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111110/230f157e/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic6_2.adb
Type: text/x-adasrc
Size: 1681 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111110/230f157e/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic6_4.adb
Type: text/x-adasrc
Size: 1613 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111110/230f157e/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic6_8.adb
Type: text/x-adasrc
Size: 1476 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111110/230f157e/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic6_5.adb
Type: text/x-adasrc
Size: 1523 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111110/230f157e/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic6_pkg.ads
Type: text/x-adasrc
Size: 600 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111110/230f157e/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic6_6.adb
Type: text/x-adasrc
Size: 1543 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111110/230f157e/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic6_7.adb
Type: text/x-adasrc
Size: 1593 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111110/230f157e/attachment-0009.bin>


More information about the Gcc-patches mailing list