public string GetInlineModifier(eCudafyInlineMode mode) { if (Language != eLanguage.Cuda) { return(" "); } if (mode == eCudafyInlineMode.Force) { return("__forceinline__ "); } else if (mode == eCudafyInlineMode.No) { return("__noinline__ "); } return(" "); }
public static eCudafyType? GetCudafyType(this ICustomAttributeProvider med, out bool isDummy, out bool ignore, out eCudafyDummyBehaviour behaviour, out eCudafyInlineMode inlineMode) { isDummy = false; behaviour = eCudafyDummyBehaviour.Default; inlineMode = eCudafyInlineMode.Auto; ignore = false; if (med is TypeDefinition) med = med as TypeDefinition; var customInline = med.CustomAttributes.Where(ca => ca.AttributeType.Name == csCUDAFYINLINEATTRIBUTE).FirstOrDefault(); if (customInline != null) { if (customInline.ConstructorArguments.Count() > 0) inlineMode = (eCudafyInlineMode)customInline.ConstructorArguments.First().Value; } var customAttr = med.CustomAttributes.Where(ca => ca.AttributeType.Name == csCUDAFYATTRIBUTE).FirstOrDefault(); if (customAttr == null) { customAttr = med.CustomAttributes.Where(ca => ca.AttributeType.Name == csCUDAFYDUMMYATTRIBUTE).FirstOrDefault(); isDummy = customAttr != null; } if (customAttr == null) { customAttr = med.CustomAttributes.Where(ca => ca.AttributeType.Name == csCUDAFYIGNOREATTRIBUTE).FirstOrDefault(); ignore = true; } else { eCudafyType et = eCudafyType.Auto; if (customAttr.ConstructorArguments.Count() > 0) et = (eCudafyType)customAttr.ConstructorArguments.First().Value; if (customAttr.ConstructorArguments.Count() > 1) behaviour = (eCudafyDummyBehaviour)customAttr.ConstructorArguments.ElementAt(1).Value; return et; } return null; }
/// <summary> /// Constructor. /// </summary> /// <param name="mode"></param> public CudafyInlineAttribute(eCudafyInlineMode mode) { Mode = mode; }
public static eCudafyType?GetCudafyType(this ICustomAttributeProvider med, out bool isDummy, out bool ignore, out eCudafyDummyBehaviour behaviour, out eCudafyInlineMode inlineMode) { isDummy = false; behaviour = eCudafyDummyBehaviour.Default; inlineMode = eCudafyInlineMode.Auto; ignore = false; if (med is TypeDefinition) { med = med as TypeDefinition; } var customInline = med.CustomAttributes.Where(ca => ca.AttributeType.Name == csCUDAFYINLINEATTRIBUTE).FirstOrDefault(); if (customInline != null) { if (customInline.ConstructorArguments.Count() > 0) { inlineMode = (eCudafyInlineMode)customInline.ConstructorArguments.First().Value; } } var customAttr = med.CustomAttributes.Where(ca => ca.AttributeType.Name == csCUDAFYATTRIBUTE).FirstOrDefault(); if (customAttr == null) { customAttr = med.CustomAttributes.Where(ca => ca.AttributeType.Name == csCUDAFYDUMMYATTRIBUTE).FirstOrDefault(); isDummy = customAttr != null; } if (customAttr == null) { customAttr = med.CustomAttributes.Where(ca => ca.AttributeType.Name == csCUDAFYIGNOREATTRIBUTE).FirstOrDefault(); ignore = true; } else { eCudafyType et = eCudafyType.Auto; if (customAttr.ConstructorArguments.Count() > 0) { et = (eCudafyType)customAttr.ConstructorArguments.First().Value; } if (customAttr.ConstructorArguments.Count() > 1) { behaviour = (eCudafyDummyBehaviour)customAttr.ConstructorArguments.ElementAt(1).Value; } return(et); } return(null); }
public string GetInlineModifier(eCudafyInlineMode mode) { if (Language != eLanguage.Cuda) return " "; if(mode == eCudafyInlineMode.Force) return "__forceinline__ "; else if(mode == eCudafyInlineMode.No) return "__noinline__ "; return " "; }
/// <summary> /// Constructor. /// </summary> /// <param name="mode"></param> public CudafyInlineAttribute(eCudafyInlineMode mode) { Mode = mode; }