[cfe-commits] [llvm-commits] [PATCH] Add llvm.fmuladd intrinsic.

Douglas Gregor dgregor at apple.com
Fri Jun 1 11:28:34 PDT 2012

On May 31, 2012, at 7:51 PM, Lang Hames <lhames at gmail.com> wrote:

> Hi John,
> Yep - I'm not sure what to do about that. At the moment all we have in the way of defaults is the language options DefaultFPContract value. Perhaps it's reasonable to have a per-target DefaultFPContract value that can override the language default. When it comes to explicitly referencing the pragma I'm not sure what the best way to handle that is - As I understand it we won't know how many functions it applies to (and thus whether it's a good candidate as a global default) until we've already parsed them.

I think it's completely reasonable to have the target provide the default, and only add the FPContract attribute to the AST if it is either (a) specified directly by the user, or (b) under control of a #pragma that provides a value that is not the default for that target. The accessor for "get the effective FPContract value" will then check for the attribute and, if not present, return the target's default. 

I think this gives us what we want---per-target control, low memory usage in the common case, and a clean way to fit it into the AST.

	- Doug

> - Lang.
> On Thu, May 31, 2012 at 7:40 PM, John McCall <rjmccall at apple.com> wrote:
> On May 31, 2012, at 7:22 PM, Lang Hames wrote:
> > Thanks for the suggestion Matthieu. I spoke to Doug and he recommended using attributes rather than a FunctionDecl bit to represent the fp_contract state.
> Hmm.  I had suggested a bit on FunctionDecl on the assumption that this would often be controlled globally, maybe by using a flag to control the default or by activating a #pragma before including all the headers.  Actually, I could even imagine a target (maybe a GPU target?) even opting-in to this behavior by default.  If we're going to use an Attr, we need to make sure it doesn't get added unless the current #pragma state is different from the global default;  we really don't want to be allocating an attribute for every function definition in the translation unit.
> John.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120601/618ada89/attachment.html>

More information about the cfe-commits mailing list