private SsaRegister EmitPassiveConversion_PermitRefs(Clarity.Rpa.CodeLocationTag codeLocation, SsaRegister sourceReg, CLRTypeSpec destType, CppCfgNodeOutline outline, IList<Clarity.Rpa.HighInstruction> instrs) { switch (sourceReg.VType.ValType) { case VType.ValTypeEnum.ManagedPtr: if (sourceReg.VType.TypeSpec.Equals(destType)) return sourceReg; throw new ArgumentException(); default: return EmitPassiveConversion(codeLocation, sourceReg, destType, outline, instrs); } }
private Clarity.Rpa.HighCfgNodeHandle InternHighCfgNode(CfgNode cfgNode) { Clarity.Rpa.HighCfgNodeHandle highNode = null; if (!m_nodesToEmittedNodes.TryGetValue(cfgNode, out highNode)) { highNode = new Clarity.Rpa.HighCfgNodeHandle(); CppCfgNodeOutline outline = new CppCfgNodeOutline(cfgNode); m_nodesToEmittedNodes.Add(cfgNode, highNode); m_nodeOutlines.Add(cfgNode, outline); m_pendingNodes.Enqueue(cfgNode); } return highNode; }
private SsaRegister EmitPassiveConversion(Clarity.Rpa.CodeLocationTag codeLocation, SsaRegister sourceReg, CLRTypeSpec destType, CppCfgNodeOutline outline, IList<Clarity.Rpa.HighInstruction> instrs) { if (sourceReg.VType.ValType == VType.ValTypeEnum.DelegateSimpleMethod || sourceReg.VType.ValType == VType.ValTypeEnum.DelegateVirtualMethod) return sourceReg; if (sourceReg.VType.TypeSpec.Equals(destType)) return sourceReg; if (sourceReg.VType.ValType == VType.ValTypeEnum.Null) { SsaRegister nullReg = new SsaRegister(new VType(VType.ValTypeEnum.Null, destType)); nullReg.MakeUsable(); nullReg.GenerateUniqueID(m_regAllocator); outline.AddRegister(nullReg); return nullReg; } SsaRegister newReg; switch (sourceReg.VType.ValType) { case VType.ValTypeEnum.ConstantReference: case VType.ValTypeEnum.ReferenceValue: newReg = new SsaRegister(new VType(VType.ValTypeEnum.ReferenceValue, destType)); break; case VType.ValTypeEnum.ValueValue: case VType.ValTypeEnum.ConstantValue: newReg = new SsaRegister(new VType(VType.ValTypeEnum.ValueValue, destType)); break; default: throw new ArgumentException(); } newReg.MakeUsable(); newReg.GenerateUniqueID(m_regAllocator); instrs.Add(new Clarity.Rpa.Instructions.PassiveConvertInstruction( codeLocation, InternSsaRegister(newReg), InternSsaRegister(sourceReg) )); return newReg; }