Пример #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];
Пример #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];
Пример #3
0
 /// <summary>
 /// Constructs a new abstract register.
 /// </summary>
 protected Register(TypeNode type, BasicValueType basicValueType)
 {
     Type           = type;
     BasicValueType = basicValueType;
 }
Пример #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;
 }
Пример #5
0
 /// <summary>
 /// Returns the corresponding managed basic value type.
 /// </summary>
 protected override Type GetManagedType() => BasicValueType.GetManagedType();
Пример #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());
 }
Пример #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];
Пример #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));
Пример #9
0
 /// <summary>
 /// Constructs a new primitive type.
 /// </summary>
 /// <param name="basicValueType">The basic value type.</param>
 internal PrimitiveType(BasicValueType basicValueType)
 {
     BasicValueType = basicValueType;
 }
Пример #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);
            }
Пример #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);
Пример #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;
 }
Пример #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);
Пример #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));
Пример #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];
Пример #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);
Пример #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;
 }
Пример #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));
Пример #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;
Пример #20
0
 /// <summary cref="Node.ToPrefixString"/>
 protected override string ToPrefixString() =>
 BasicValueType.ToString();
Пример #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));
 }