提交 46df51f8 编写于 作者: C Christian Steinert 提交者: Kevin Ransom (msft)

[WIP] Adds optimized emit for int64 constants (#3620)

* Adds optimized emit for int64 constants.

* Adds comment linking to the changing PR.

Thanks for this PR.

Kevin
上级 383e2f65
......@@ -2072,7 +2072,14 @@ and GenConstant cenv cgbuf eenv (c,m,ty) sequel =
| Const.SByte i -> CG.EmitInstr cgbuf (pop 0) (Push [ilTy]) (mkLdcInt32 (int32 i))
| Const.Int16 i -> CG.EmitInstr cgbuf (pop 0) (Push [ilTy]) (mkLdcInt32 (int32 i))
| Const.Int32 i -> CG.EmitInstr cgbuf (pop 0) (Push [ilTy]) (mkLdcInt32 i)
| Const.Int64 i -> CG.EmitInstr cgbuf (pop 0) (Push [ilTy]) (iLdcInt64 i)
| Const.Int64 i ->
// see https://github.com/Microsoft/visualfsharp/pull/3620
if i >= int64 System.Int32.MinValue && i <= int64 System.Int32.MaxValue then
CG.EmitInstrs cgbuf (pop 0) (Push [ilTy]) [ mkLdcInt32 (int32 i); AI_conv DT_I8 ]
elif i >= int64 System.UInt32.MinValue && i <= int64 System.UInt32.MaxValue then
CG.EmitInstrs cgbuf (pop 0) (Push [ilTy]) [ mkLdcInt32 (int32 i); AI_conv DT_U8 ]
else
CG.EmitInstr cgbuf (pop 0) (Push [ilTy]) (iLdcInt64 i)
| Const.IntPtr i -> CG.EmitInstrs cgbuf (pop 0) (Push [ilTy]) [iLdcInt64 i; AI_conv DT_I ]
| Const.Byte i -> CG.EmitInstr cgbuf (pop 0) (Push [ilTy]) (mkLdcInt32 (int32 i))
| Const.UInt16 i -> CG.EmitInstr cgbuf (pop 0) (Push [ilTy]) (mkLdcInt32 (int32 i))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册