예제 #1
0
파일: Memory.cs 프로젝트: nguyenvuduc/ILGPU
 private static TypeNode ComputeType(
     IRContext context,
     TypeNode allocaType,
     MemoryAddressSpace addressSpace)
 {
     return(context.CreatePointerType(
                allocaType,
                addressSpace));
 }
예제 #2
0
        private static AddressSpaceType ComputeType(
            IRContext context,
            TypeNode sourceType,
            TypeNode targetElementType)
        {
            var pointerType = sourceType as PointerType;

            Debug.Assert(pointerType != null, "Invalid pointer type");
            return(context.CreatePointerType(
                       targetElementType,
                       pointerType.AddressSpace));
        }
예제 #3
0
        private static TypeNode ComputeType(
            IRContext context,
            ValueReference source)
        {
            var sourceType = source.Type as AddressSpaceType;

            if (sourceType is PointerType)
            {
                return(sourceType);
            }
            return(context.CreatePointerType(
                       sourceType.ElementType,
                       sourceType.AddressSpace));
        }
예제 #4
0
        private static TypeNode ComputeType(
            IRContext context,
            ValueReference source,
            int fieldIndex)
        {
            var pointerType = source.Type as PointerType;

            Debug.Assert(pointerType != null, "Invalid pointer type");
            var structureType = pointerType.ElementType as StructureType;

            Debug.Assert(structureType != null, "Invalid structure type");
            var fieldType = structureType.Fields[fieldIndex];

            return(context.CreatePointerType(
                       fieldType,
                       pointerType.AddressSpace));
        }
예제 #5
0
 private static AddressSpaceType ComputeType(
     IRContext context,
     TypeNode sourceType,
     MemoryAddressSpace targetAddressSpace)
 {
     if (sourceType is ViewType viewType)
     {
         return(context.CreateViewType(
                    viewType.ElementType,
                    targetAddressSpace));
     }
     else
     {
         var pointerType = sourceType as PointerType;
         return(context.CreatePointerType(
                    pointerType.ElementType,
                    targetAddressSpace));
     }
 }