Exemplo n.º 1
0
 /// <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];
Exemplo n.º 2
0
 /// <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];
Exemplo n.º 3
0
 /// <summary>
 /// Constructs a new abstract register.
 /// </summary>
 protected Register(TypeNode type, BasicValueType basicValueType)
 {
     Type           = type;
     BasicValueType = basicValueType;
 }
Exemplo n.º 4
0
 /// <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;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Returns the corresponding managed basic value type.
 /// </summary>
 protected override Type GetManagedType() => BasicValueType.GetManagedType();
Exemplo n.º 6
0
 /// <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());
 }
Exemplo n.º 7
0
 /// <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];
Exemplo n.º 8
0
 /// <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));
Exemplo n.º 9
0
 /// <summary>
 /// Constructs a new primitive type.
 /// </summary>
 /// <param name="basicValueType">The basic value type.</param>
 internal PrimitiveType(BasicValueType basicValueType)
 {
     BasicValueType = basicValueType;
 }
Exemplo n.º 10
0
            /// <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);
            }
Exemplo n.º 11
0
 /// <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);
Exemplo n.º 12
0
 /// <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;
 }
Exemplo n.º 13
0
 /// <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);
Exemplo n.º 14
0
 /// <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));
Exemplo n.º 15
0
 /// <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];
Exemplo n.º 16
0
 /// <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);
Exemplo n.º 17
0
 /// <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;
 }
Exemplo n.º 18
0
 /// <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));
Exemplo n.º 19
0
 /// <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;
Exemplo n.º 20
0
 /// <summary cref="Node.ToPrefixString"/>
 protected override string ToPrefixString() =>
 BasicValueType.ToString();
Exemplo n.º 21
0
 /// <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));
 }