/// <summary> /// Resolves a select-value operation. /// </summary> /// <param name="type">The basic value type.</param> /// <returns>The resolved select-value operation.</returns> public static string GetSelectValueOperation(BasicValueType type) => SelectValueOperations[type];
/// <summary> /// Resolves the given basic-value type to an OpenCL type name. /// </summary> /// <param name="basicValueType">The basic-value type to resolve.</param> /// <returns>The resolved OpenCL type name.</returns> public string GetBasicValueType(BasicValueType basicValueType) => basicValueType == BasicValueType.Float16 && !Capabilities.Float16 ? throw CLCapabilityContext.GetNotSupportedFloat16Exception() : basicValueType == BasicValueType.Float64 && !Capabilities.Float64 ? throw CLCapabilityContext.GetNotSupportedFloat64Exception() : BasicTypeMapping[(int)basicValueType];
/// <summary> /// Constructs a new abstract register. /// </summary> protected Register(TypeNode type, BasicValueType basicValueType) { Type = type; BasicValueType = basicValueType; }
/// <summary> /// Constructs a new register description. /// </summary> /// <param name="basicValueType">The basic value type.</param> /// <param name="kind">The register kind.</param> public RegisterDescription(BasicValueType basicValueType, TKind kind) { BasicValueType = basicValueType; Kind = kind; }
/// <summary> /// Returns the corresponding managed basic value type. /// </summary> protected override Type GetManagedType() => BasicValueType.GetManagedType();
/// <summary> /// Returns true iff the given basic-value type represents either a ptr or an int. /// </summary> /// <param name="value">The basic-value type.</param> /// <returns>True, iff the given basic-value type represents either a ptr or an int.</returns> public static bool IsPtrOrInt(this BasicValueType value) { return(value == BasicValueType.Ptr || value.IsInt()); }
/// <summary> /// Resolves the primitive type that corresponds to the given <see cref="BasicValueType"/>. /// </summary> /// <param name="basicValueType">The basic value type.</param> /// <returns>The created primitive type.</returns> public PrimitiveType GetPrimitiveType(BasicValueType basicValueType) => basicValueTypes[(int)basicValueType];
/// <summary> /// Appends the given command basic value type suffix. /// </summary> /// <param name="basicValueType">The type suffix.</param> public void AppendSuffix(BasicValueType basicValueType) => AppendSuffix(GetBasicSuffix(basicValueType));
/// <summary> /// Constructs a new primitive type. /// </summary> /// <param name="basicValueType">The basic value type.</param> internal PrimitiveType(BasicValueType basicValueType) { BasicValueType = basicValueType; }
/// <summary> /// Appends a cast to the given basic value type. /// </summary> /// <param name="type">The target type.</param> public void AppendCast(BasicValueType type) { var typeExpression = CLTypeGenerator.GetBasicValueType(type); AppendCast(typeExpression); }
/// <summary> /// Returns true if the given basic value type can be used in combination with /// a view type. /// </summary> /// <param name="basicValueType"></param> /// <returns> /// True if the given value type is a compatible view index type. /// </returns> internal static bool IsViewIndexType(BasicValueType basicValueType) => Bitwise.Or( basicValueType == BasicValueType.Int32, basicValueType == BasicValueType.Int64);
/// <summary> /// Constructs a new primitive variable. /// </summary> /// <param name="id">The current variable id.</param> /// <param name="basicValueType">The basic value type.</param> internal PrimitiveVariable(int id, BasicValueType basicValueType) : base(id) { BasicValueType = basicValueType; }
/// <summary> /// Allocates the given type. /// </summary> /// <param name="basicValueType">The type to allocate.</param> /// <returns>The allocated variable.</returns> public Variable AllocateType(BasicValueType basicValueType) => new PrimitiveVariable(idCounter++, basicValueType);
/// <summary> /// Allocates the given type. /// </summary> /// <param name="basicValueType">The type to allocate.</param> /// <returns>The allocated variable.</returns> public Variable AllocateType(BasicValueType basicValueType) => new PrimitiveVariable( idCounter++, basicValueType.GetArithmeticBasicValueType(false));
/// <summary> /// Resolves the given basic-value type to an OpenCL type name. /// </summary> /// <param name="basicValueType">The basic-value type to resolve.</param> /// <returns>The resolved OpenCL type name.</returns> public static string GetBasicValueType(BasicValueType basicValueType) => BasicTypeMapping[(int)basicValueType];
/// <summary> /// Resolves the primitive type that corresponds to the given /// <see cref="BasicValueType"/>. /// </summary> /// <param name="basicValueType">The basic value type.</param> /// <returns>The created primitive type.</returns> public PrimitiveType GetPrimitiveType(BasicValueType basicValueType) => TypeContext.GetPrimitiveType(basicValueType);
/// <summary> /// Defines a new type information for the specified basic value type. /// </summary> /// <param name="basicValueType">The type to define.</param> /// <param name="size">New size information</param> protected void DefineBasicTypeInformation(BasicValueType basicValueType, int size) { basicTypeInformation[basicValueType] = size; }
/// <summary> /// Appends a specialized basic type suffix for mov instructions. /// </summary> /// <param name="basicValueType">The type suffix.</param> public void AppendRegisterMovementSuffix(BasicValueType basicValueType) => AppendSuffix(ResolveRegisterMovementType(basicValueType));
/// <summary> /// Returns true if the given basic value type can be used in combination with /// a view type. /// </summary> /// <param name="basicValueType"></param> /// <returns> /// True if the given value type is a compatible view index type. /// </returns> internal static bool IsViewIndexType(BasicValueType basicValueType) => basicValueType == BasicValueType.Int32 | basicValueType == BasicValueType.Int64;
/// <summary cref="Node.ToPrefixString"/> protected override string ToPrefixString() => BasicValueType.ToString();
/// <summary> /// Returns true iff the given basic-value type represents an int. /// </summary> /// <param name="value">The basic-value type.</param> /// <returns>True, iff the given basic-value type represents an int.</returns> public static bool IsInt(this BasicValueType value) { return(IsSignedInt(value) || IsUnsignedInt(value)); }