本文整理汇总了C#中CodeGeneration.CGenState.FSTS方法的典型用法代码示例。如果您正苦于以下问题:C# CGenState.FSTS方法的具体用法?C# CGenState.FSTS怎么用?C# CGenState.FSTS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGeneration.CGenState
的用法示例。
在下文中一共展示了CGenState.FSTS方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalcAndSaveFloat
public override void CalcAndSaveFloat(CGenState state) {
state.FSUB(1, 0);
state.FSTS(0, Reg.ECX);
}
示例2: CGenValue
public override Reg CGenValue(CGenState state) {
// 1. %eax = &left
this.Left.CGenAddress(state);
// 2. push %eax
Int32 pos = state.CGenPushLong(Reg.EAX);
Reg ret = this.Right.CGenValue(state);
switch (this.Left.Type.Kind) {
case ExprTypeKind.CHAR:
case ExprTypeKind.UCHAR:
// pop %ebx
// now %ebx = %Left
state.CGenPopLong(pos, Reg.EBX);
// *%ebx = %al
state.MOVB(Reg.AL, 0, Reg.EBX);
return Reg.EAX;
case ExprTypeKind.SHORT:
case ExprTypeKind.USHORT:
// pop %ebx
// now %ebx = %Left
state.CGenPopLong(pos, Reg.EBX);
// *%ebx = %al
state.MOVW(Reg.AX, 0, Reg.EBX);
return Reg.EAX;
case ExprTypeKind.LONG:
case ExprTypeKind.ULONG:
case ExprTypeKind.POINTER:
// pop %ebx
// now %ebx = &Left
state.CGenPopLong(pos, Reg.EBX);
// *%ebx = %al
state.MOVL(Reg.EAX, 0, Reg.EBX);
return Reg.EAX;
case ExprTypeKind.FLOAT:
// pop %ebx
// now %ebx = &Left
state.CGenPopLong(pos, Reg.EBX);
// *%ebx = %st(0)
state.FSTS(0, Reg.EBX);
return Reg.ST0;
case ExprTypeKind.DOUBLE:
// pop %ebx
// now %ebx = &Left
state.CGenPopLong(pos, Reg.EBX);
// *%ebx = %st(0)
state.FSTL(0, Reg.EBX);
return Reg.ST0;
case ExprTypeKind.STRUCT_OR_UNION:
// pop %edi
// now %edi = &Left
state.CGenPopLong(pos, Reg.EDI);
// %esi = &Right
state.MOVL(Reg.EAX, Reg.ESI);
// %ecx = nbytes
state.MOVL(this.Left.Type.SizeOf, Reg.ECX);
state.CGenMemCpy();
// %eax = &Left
state.MOVL(Reg.EDI, Reg.EAX);
return Reg.EAX;
case ExprTypeKind.FUNCTION:
case ExprTypeKind.VOID:
case ExprTypeKind.ARRAY:
case ExprTypeKind.INCOMPLETE_ARRAY:
default:
throw new InvalidProgramException("cannot assign to a " + this.Type.Kind);
}
}