本文整理汇总了C#中CodeGeneration.CGenState.MOVZWL方法的典型用法代码示例。如果您正苦于以下问题:C# CGenState.MOVZWL方法的具体用法?C# CGenState.MOVZWL怎么用?C# CGenState.MOVZWL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGeneration.CGenState
的用法示例。
在下文中一共展示了CGenState.MOVZWL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CGenValue
public override Reg CGenValue(CGenState state) {
Reg ret = this.Expr.CGenValue(state);
switch (this.Kind) {
case TypeCastType.DOUBLE_TO_FLOAT:
case TypeCastType.FLOAT_TO_DOUBLE:
case TypeCastType.PRESERVE_INT16:
case TypeCastType.PRESERVE_INT8:
case TypeCastType.NOP:
return ret;
case TypeCastType.DOUBLE_TO_INT32:
case TypeCastType.FLOAT_TO_INT32:
state.CGenConvertFloatToLong();
return Reg.EAX;
case TypeCastType.INT32_TO_DOUBLE:
case TypeCastType.INT32_TO_FLOAT:
state.CGenConvertLongToFloat();
return Reg.ST0;
case TypeCastType.INT16_TO_INT32:
state.MOVSWL(Reg.AX, Reg.EAX);
return ret;
case TypeCastType.INT8_TO_INT16:
case TypeCastType.INT8_TO_INT32:
state.MOVSBL(Reg.AL, Reg.EAX);
return ret;
case TypeCastType.UINT16_TO_UINT32:
state.MOVZWL(Reg.AX, Reg.EAX);
return ret;
case TypeCastType.UINT8_TO_UINT16:
case TypeCastType.UINT8_TO_UINT32:
state.MOVZBL(Reg.AL, Reg.EAX);
return ret;
default:
throw new InvalidProgramException();
}
}
示例2: CGenValue
public override Reg CGenValue(CGenState state) {
// %eax is the address of the struct/union
if (this.Expr.CGenValue(state) != Reg.EAX) {
throw new InvalidProgramException();
}
if (this.Expr.Type.Kind != ExprTypeKind.STRUCT_OR_UNION) {
throw new InvalidProgramException();
}
// size of the struct or union
Int32 struct_size = this.Expr.Type.SizeOf;
// offset inside the pack
Int32 attrib_offset = ((StructOrUnionType)this.Expr.Type)
.Attribs
.First(_ => _.name == this.Name)
.offset;
// can't be a function designator.
switch (this.Type.Kind) {
case ExprTypeKind.ARRAY:
case ExprTypeKind.STRUCT_OR_UNION:
state.ADDL(attrib_offset, Reg.EAX);
return Reg.EAX;
case ExprTypeKind.CHAR:
state.MOVSBL(attrib_offset, Reg.EAX, Reg.EAX);
return Reg.EAX;
case ExprTypeKind.UCHAR:
state.MOVZBL(attrib_offset, Reg.EAX, Reg.EAX);
return Reg.EAX;
case ExprTypeKind.SHORT:
state.MOVSWL(attrib_offset, Reg.EAX, Reg.EAX);
return Reg.EAX;
case ExprTypeKind.USHORT:
state.MOVZWL(attrib_offset, Reg.EAX, Reg.EAX);
return Reg.EAX;
case ExprTypeKind.LONG:
case ExprTypeKind.ULONG:
case ExprTypeKind.POINTER:
state.MOVL(attrib_offset, Reg.EAX, Reg.EAX);
return Reg.EAX;
case ExprTypeKind.FLOAT:
state.FLDS(attrib_offset, Reg.EAX);
return Reg.ST0;
case ExprTypeKind.DOUBLE:
state.FLDL(attrib_offset, Reg.EAX);
return Reg.ST0;
default:
throw new InvalidProgramException();
}
}