Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle all integral types & arbitrary steps #1

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
401 changes: 296 additions & 105 deletions src/Compiler/Optimize/LowerComputedCollections.fs

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion src/Compiler/TypedTree/TcGlobals.fs
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,16 @@ type TcGlobals(
let v_range_op_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Range" , None , None , [vara], ([[varaTy];[varaTy]], mkSeqTy varaTy))
let v_range_step_op_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_RangeStep" , None , None , [vara;varb], ([[varaTy];[varbTy];[varaTy]], mkSeqTy varaTy))
let v_range_int32_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeInt32" , None , None , [], ([[v_int_ty];[v_int_ty];[v_int_ty]], mkSeqTy v_int_ty))
let v_range_int64_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeInt64" , None , None , [], ([[v_int64_ty];[v_int64_ty];[v_int64_ty]], mkSeqTy v_int64_ty))
let v_range_uint64_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeUInt64" , None , None , [], ([[v_uint64_ty];[v_uint64_ty];[v_uint64_ty]], mkSeqTy v_uint64_ty))
let v_range_uint32_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeUInt32" , None , None , [], ([[v_uint32_ty];[v_uint32_ty];[v_uint32_ty]], mkSeqTy v_uint32_ty))
let v_range_nativeint_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeIntPtr" , None , None , [], ([[v_nativeint_ty];[v_nativeint_ty];[v_nativeint_ty]], mkSeqTy v_nativeint_ty))
let v_range_unativeint_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeUIntPtr" , None , None , [], ([[v_unativeint_ty];[v_unativeint_ty];[v_unativeint_ty]], mkSeqTy v_unativeint_ty))
let v_range_int16_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeInt16" , None , None , [], ([[v_int16_ty];[v_int16_ty];[v_int16_ty]], mkSeqTy v_int16_ty))
let v_range_uint16_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeUInt16" , None , None , [], ([[v_uint16_ty];[v_uint16_ty];[v_uint16_ty]], mkSeqTy v_uint16_ty))
let v_range_sbyte_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeSByte" , None , None , [], ([[v_sbyte_ty];[v_sbyte_ty];[v_sbyte_ty]], mkSeqTy v_sbyte_ty))
let v_range_byte_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeByte" , None , None , [], ([[v_byte_ty];[v_byte_ty];[v_byte_ty]], mkSeqTy v_byte_ty))
let v_range_char_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeChar" , None , None , [], ([[v_char_ty];[v_char_ty];[v_char_ty]], mkSeqTy v_char_ty))

let v_array_length_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "length" , None , Some "Length" , [vara], ([[mkArrayType 1 varaTy]], v_int_ty))
let v_array_init_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "init" , None , Some "Initialize", [vara], ([[v_int32_ty]; [v_int32_ty --> varaTy]], mkArrayType 1 varaTy))
Expand All @@ -821,7 +831,7 @@ type TcGlobals(
let v_array3D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray3D" , None , None , [vara], ([[mkArrayType 3 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty))
let v_array4D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray4D" , None , None , [vara], ([[mkArrayType 4 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty))

let v_list_init_info = makeIntrinsicValRef(fslib_MFListModule_nleref, "init" , None , Some "Initialize", [vara], ([[v_int32_ty]; [v_int32_ty --> varaTy]], mkListTy varaTy))
let v_list_init_info = makeIntrinsicValRef(fslib_MFListModule_nleref, "init" , None , Some "Initialize", [vara], ([[v_int32_ty]; [v_int32_ty --> varaTy]], mkListTy varaTy))

let v_option_toNullable_info = makeIntrinsicValRef(fslib_MFOptionModule_nleref, "toNullable" , None , Some "ToNullable" , [vara], ([[mkOptionTy varaTy]], mkNullableTy varaTy))
let v_option_defaultValue_info = makeIntrinsicValRef(fslib_MFOptionModule_nleref, "defaultValue" , None , Some "DefaultValue" , [vara], ([[varaTy]; [mkOptionTy varaTy]], varaTy))
Expand Down Expand Up @@ -1690,6 +1700,16 @@ type TcGlobals(
member val range_op_vref = ValRefForIntrinsic v_range_op_info
member val range_step_op_vref = ValRefForIntrinsic v_range_step_op_info
member val range_int32_op_vref = ValRefForIntrinsic v_range_int32_op_info
member val range_int64_op_vref = ValRefForIntrinsic v_range_int64_op_info
member val range_uint64_op_vref = ValRefForIntrinsic v_range_uint64_op_info
member val range_uint32_op_vref = ValRefForIntrinsic v_range_uint32_op_info
member val range_nativeint_op_vref = ValRefForIntrinsic v_range_nativeint_op_info
member val range_unativeint_op_vref = ValRefForIntrinsic v_range_unativeint_op_info
member val range_int16_op_vref = ValRefForIntrinsic v_range_int16_op_info
member val range_uint16_op_vref = ValRefForIntrinsic v_range_uint16_op_info
member val range_sbyte_op_vref = ValRefForIntrinsic v_range_sbyte_op_info
member val range_byte_op_vref = ValRefForIntrinsic v_range_byte_op_info
member val range_char_op_vref = ValRefForIntrinsic v_range_char_op_info
member val array_get_vref = ValRefForIntrinsic v_array_get_info
member val array2D_get_vref = ValRefForIntrinsic v_array2D_get_info
member val array3D_get_vref = ValRefForIntrinsic v_array3D_get_info
Expand Down
2 changes: 2 additions & 0 deletions src/Compiler/TypedTree/TypedTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7757,6 +7757,8 @@ let mkCallArray4DSet (g: TcGlobals) m ty e1 idx1 idx2 idx3 idx4 v = mkApps g (ty

let mkCallListInit (g: TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.list_init_info, [[ty]], [e1; e2], m)

let mkCallInvalidArg (g: TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.invalid_arg_info, [[ty]], [e1; e2], m)

let mkCallHash (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.hash_info, [[ty]], [ e1 ], m)

let mkCallBox (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.box_info, [[ty]], [ e1 ], m)
Expand Down
2 changes: 2 additions & 0 deletions src/Compiler/TypedTree/TypedTreeOps.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -2035,6 +2035,8 @@ val mkCallArray4DSet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Exp

val mkCallListInit: TcGlobals -> range -> TType -> Expr -> Expr -> Expr

val mkCallInvalidArg: TcGlobals -> range -> TType -> Expr -> Expr -> Expr

val mkCallHash: TcGlobals -> range -> TType -> Expr -> Expr

val mkCallBox: TcGlobals -> range -> TType -> Expr -> Expr
Expand Down
Loading