本文整理汇总了C#中TypeReference.IsWide方法的典型用法代码示例。如果您正苦于以下问题:C# TypeReference.IsWide方法的具体用法?C# TypeReference.IsWide怎么用?C# TypeReference.IsWide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeReference
的用法示例。
在下文中一共展示了TypeReference.IsWide方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Allocate
/// <summary>
/// Allocate a register for the given type.
/// </summary>
protected override RegisterSpec Allocate(TypeReference type, bool forceObject, RCategory category, object parameter)
{
var isWide = !forceObject && type.IsWide();
if (isWide)
{
var pair = body.AllocateWideRegister(category);
switch (category)
{
case RCategory.Temp:
return new RegisterSpec(pair.Item1, pair.Item2, type);
case RCategory.Variable:
return new VariableRegisterSpec(pair.Item1, pair.Item2, type, (AstVariable)parameter);
case RCategory.Argument:
return new ArgumentRegisterSpec(pair.Item1, pair.Item2, type, ParameterWrapper.Wrap(parameter));
default:
throw new ArgumentException("Unknown category " + category);
}
}
var isPrimitive = !forceObject && (type is PrimitiveType);
var register = body.AllocateRegister(category, isPrimitive ? RType.Value : RType.Object);
switch (category)
{
case RCategory.Temp:
return new RegisterSpec(register, null, type);
case RCategory.Variable:
return new VariableRegisterSpec(register, null, type, (AstVariable) parameter);
case RCategory.Argument:
return new ArgumentRegisterSpec(register, null, type, ParameterWrapper.Wrap(parameter));
default:
throw new ArgumentException("Unknown category " + category);
}
}