[PATCH] Target-specific attributes
Alp Toker
alp at nuanti.com
Sat Jan 4 13:55:54 PST 2014
Hi Aaron,
The identical-looking blocks look like a straight code-move so I haven't
examined them closely (if there are any significant changes in there, do
mention). Here's the rest..
> +// Defines targets for target-specific attributes. The list of
> strings should
> +// specify architectures for which the target applies, based off the
> ArchType
> +// enumeration in Triple.h.
> +class TargetArch<list<string> arches> {
> + list<string> Arches = arches;
> + list<string> OSes;
> +}
> +def TargetARM : TargetArch<["arm", "thumb"]>;
> +def TargetMSP430 : TargetArch<["msp430"]>;
> +def TargetX86 : TargetArch<["x86"]>;
> +def TargetX86Win : TargetArch<["x86", "x86_64"]> {
> + let OSes = ["Win32", "MinGW32"];
> +}
> +def TargetMips : TargetArch<["mips", "mipsel"]>;
> +
Feels like it'd be more TableGen-ish to apply TargetArch<> directly to
the instances without listing these utility wrappers. Maybe only provide
the defs for TargetMips and TargetARM that add value? It's your call
though if you prefer to keep it this way -- I don't have a strong
opinion here.
> -def DLLExport : InheritableAttr, TargetSpecificAttr {
> +def DLLExport : InheritableAttr, TargetSpecificAttr<TargetX86Win> {
> let Spellings = [Declspec<"dllexport">];
> let Subjects = SubjectList<[Function, Var]>;
> }
>
> -def DLLImport : InheritableAttr, TargetSpecificAttr {
> +def DLLImport : InheritableAttr, TargetSpecificAttr<TargetX86Win> {
> let Spellings = [Declspec<"dllimport">];
> // Technically, the subjects for DllImport are Function and Var,
> but there is
> // custom semantic handling required when MicrosoftExt is true.
Any reason for dllimport / dllexport to be x86 target attributes? That
quirk looks like a historical leftover that can be handled by the
["Win32", "MinGW32"] predicate alone thanks to your changes. MSDN
documents them as being general language features not specific to x86
and I believe they apply to other Microsoft architectures equally.
Alp.
On 04/01/2014 16:33, Aaron Ballman wrote:
> New Years ping, with another rebased patch. :-)
>
> ~Aaron
>
> On Fri, Dec 27, 2013 at 12:10 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> Holiday ping, with rebased patch.
>>
>> ~Aaron
>>
>> On Thu, Dec 19, 2013 at 10:11 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
>>> Ping
>>>
>>> On Sun, Dec 15, 2013 at 8:49 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
>>>> This patch removes the TargetAttributesSema concept and replaces it
>>>> with one where the parsed attributes are responsible for knowing their
>>>> target-specific nature, instead of letting Sema figure it out. This is
>>>> necessary so that __has_attribute can eventually determine whether a
>>>> parsed attribute applies to the given target or not.
>>>>
>>>> All of the semantic handling which was previously in
>>>> TargetAttributesSema.cpp has been moved to SemaDeclAttr.cpp, but still
>>>> only applies to the specific target by asking the attribute whether it
>>>> exists in the given target or not. The target-specific information is
>>>> generated automatically via tablegen.
>>>>
>>>> ~Aaron
>>>>
>>>>
>>>> _______________________________________________
>>>> cfe-commits mailing list
>>>> cfe-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
--
http://www.nuanti.com
the browser experts
More information about the cfe-commits
mailing list