kerneis / cpc

Continuation Passing C
http://www.pps.univ-paris-diderot.fr/~kerneis/software/cpc
Other
112 stars 13 forks source link

Fix issue #7 by adding some more GCC builtin functions to CIL #8

Closed ctshepherd closed 11 years ago

ctshepherd commented 11 years ago

Fixes issue #7

kerneis commented 11 years ago

Thanks for the proposal. Unfortunately, it doesn't work because those builtins are of the "hard" kind (ie. their prototype cannot be written as a regular C function). The magic [overloaded] attribute was designed with [type __atomic_add_fetch (type *ptr, type val, int memmodel)] and others in mind, and it would not work in your case automatically. And some more magic is necessary in src/frontc/cabs2cil.ml (look for "overloaded" in a comment).

It gives me a list of the functions, though, so thanks for that. For future reference: http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

If you want to try and discuss another patch, let me know. Otherwise, I'll think about it next week.

kerneis commented 11 years ago

Sorry, I meant it was designed for [type sync_fetch_and_add (type *ptr, type value, ...)], so it would certainly support [__atomic_fetch_and_add], but not [atomic_load_n] or [__atomic_load] for instance. And src/frontc/cabs2cil.ml still needs to be adapted.