call = Call.create3(CALL, callResult, null,
call = Call.create3(CALL, callResult, I(target.getOffset()),
  private static OPT_Instruction generateBranchingTypeCheck(OPT_Instruction s, 							    OPT_IR ir, 							    OPT_Operand RHSobj,							    VM_Type LHStype, 							    OPT_RegisterOperand RHStib, 							    OPT_BasicBlock trueBlock, 							    OPT_BasicBlock falseBlock,                                                            OPT_RegisterOperand oldGuard) {    OPT_Instruction continueAt = Goto.create(GOTO, trueBlock.makeJumpTarget());    continueAt.copyPosition(s);    s.insertBefore(continueAt);    s.remove();    if (LHStype.isClassType()) {      VM_Class LHSclass = LHStype.asClass();      if (LHSclass.isResolved()) {	// Cases 4, 5, and 6 of VM_DynamicTypeCheck: LHSclass is a resolved 	// class or interface	if (LHSclass.isInterface()) {	  // A resolved interface (case 4)	  int interfaceIndex = LHSclass.getDoesImplementIndex();	  int interfaceMask = LHSclass.getDoesImplementBitMask();	  OPT_RegisterOperand doesImpl = 	    InsertUnary(continueAt, ir, GET_DOES_IMPLEMENT_FROM_TIB, 			OPT_ClassLoaderProxy.IntArrayType, RHStib);	  if (VM_DynamicTypeCheck.MIN_DOES_IMPLEMENT_SIZE <= interfaceIndex) {	    OPT_RegisterOperand doesImplLength = 	      InsertGuardedUnary(continueAt, 				 ir, ARRAYLENGTH, VM_Type.IntType, 				 doesImpl.copyD2U(), TG());	    OPT_Instruction lengthCheck = 	      IfCmp.create(INT_IFCMP, oldGuard, doesImplLength, I(interfaceIndex),			   OPT_ConditionOperand.LESS_EQUAL(), 			   falseBlock.makeJumpTarget(),			   new OPT_BranchProfileOperand());	    continueAt.insertBefore(lengthCheck);	    OPT_BasicBlock oldBlock = continueAt.getBasicBlock();	    oldBlock.splitNodeWithLinksAt(lengthCheck, ir);	    oldBlock.insertOut(falseBlock); // required due to splitNode!	  }	  OPT_RegisterOperand entry = 	    InsertLoadOffset(continueAt, ir, INT_LOAD, VM_Type.IntType,			     doesImpl, interfaceIndex << 2, 			     new OPT_LocationOperand(VM_Type.IntType), 			     TG());	  OPT_RegisterOperand bit = 	    InsertBinary(continueAt, ir, INT_AND, VM_Type.IntType, entry, I(interfaceMask));	  continueAt.insertBefore(IfCmp.create(INT_IFCMP, oldGuard, 					       bit, I(0),					       OPT_ConditionOperand.EQUAL(), 					       falseBlock.makeJumpTarget(),					       new OPT_BranchProfileOperand()));	  return continueAt;	} else {	  // A resolved class (cases 5 and 6 in VM_DynamicTypeCheck)	  if (LHSclass.isFinal()) {	    // For a final class, we can do a PTR compare of 	    // rhsTIB and the TIB of the class	    OPT_RegisterOperand classTIB = getTIB(continueAt, ir, LHSclass);	    continueAt.insertBefore(IfCmp.create(INT_IFCMP, oldGuard, 						 RHStib, classTIB,						 OPT_ConditionOperand.NOT_EQUAL(), 						 falseBlock.makeJumpTarget(),						 new OPT_BranchProfileOperand()));	    return continueAt;	  } else {	    // Do the full blown case 5 or 6 typecheck.	    int LHSDepth = LHSclass.getTypeDepth();	    int LHSId = LHSclass.getDictionaryId();	    OPT_RegisterOperand superclassIds = 	      InsertUnary(continueAt, ir, GET_SUPERCLASS_IDS_FROM_TIB, 			  OPT_ClassLoaderProxy.ShortArrayType, RHStib);	    if (VM_DynamicTypeCheck.MIN_SUPERCLASS_IDS_SIZE <= LHSDepth) {	      OPT_RegisterOperand superclassIdsLength = 		InsertGuardedUnary(continueAt, 				   ir, ARRAYLENGTH, VM_Type.IntType, 				   superclassIds.copyD2U(), TG());	      OPT_Instruction lengthCheck = 		IfCmp.create(INT_IFCMP, oldGuard, superclassIdsLength, I(LHSDepth),			     OPT_ConditionOperand.LESS(), 			     falseBlock.makeJumpTarget(),			     new OPT_BranchProfileOperand());	      continueAt.insertBefore(lengthCheck);	      OPT_BasicBlock oldBlock = continueAt.getBasicBlock();	      oldBlock.splitNodeWithLinksAt(lengthCheck, ir);	      oldBlock.insertOut(falseBlock); // required due to splitNode!	    }	    OPT_RegisterOperand refCandidate = 	      InsertLoadOffset(continueAt, ir, USHORT_LOAD, VM_Type.ShortType,			       superclassIds, LHSDepth << 1, 			       new OPT_LocationOperand(VM_Type.ShortType), 			       TG());	    continueAt.insertBefore(IfCmp.create(INT_IFCMP, oldGuard, 						 refCandidate, I(LHSId),						 OPT_ConditionOperand.NOT_EQUAL(), 						 falseBlock.makeJumpTarget(),						 new OPT_BranchProfileOperand()));	    return continueAt;	  }	}      } else {	// A non-resolved class or interface. Case 3 of VM_DynamicTypeCheck	// Branch on the result of a call to 	// VM_DynamicTypeCheck.instanceOfUnresolved	OPT_RegisterOperand LHSRuntimeClass = 	  getVMType(continueAt, ir, LHSclass);	OPT_RegisterOperand result = ir.regpool.makeTempInt();	OPT_Instruction call = Call.create2(CALL, result, null, 					    OPT_MethodOperand.STATIC(VM_Entrypoints.instanceOfUnresolvedMethod), 					    LHSRuntimeClass, RHStib);	call.copyPosition(continueAt);	continueAt.insertBefore(call);	call = _callHelper(call, ir);	continueAt.insertBefore(IfCmp.create(INT_IFCMP, oldGuard, 					     result.copyD2U(), I(0),					     OPT_ConditionOperand.EQUAL(), 					     falseBlock.makeJumpTarget(),					     new OPT_BranchProfileOperand()));	return continueAt;      }    }    if (LHStype.isArrayType()) {      // Case 2 of VM_DynamicTypeCheck: LHS is an array.      VM_Array LHSArray = LHStype.asArray();      OPT_RegisterOperand classTIB = getTIB(continueAt, ir, LHSArray);      VM_Type innermostElementType = LHSArray.getInnermostElementType();      if (innermostElementType.isPrimitiveType() || 	  (innermostElementType.asClass().isResolved() && 	   innermostElementType.asClass().isFinal())) {	// [^k of primitive or [^k of final class. Just like final classes, 	// a PTR compare of rhsTIB and the TIB of the class gives the answer.	continueAt.insertBefore(IfCmp.create(REF_IFCMP, oldGuard, 					     RHStib, classTIB,					     OPT_ConditionOperand.NOT_EQUAL(), 					     falseBlock.makeJumpTarget(),					     new OPT_BranchProfileOperand()));	return continueAt;      }      OPT_Instruction shortcircuit = 	IfCmp.create(REF_IFCMP, oldGuard, RHStib, classTIB,		     OPT_ConditionOperand.EQUAL(), 		     trueBlock.makeJumpTarget(),		     new OPT_BranchProfileOperand());      continueAt.insertBefore(shortcircuit);      OPT_BasicBlock myBlock = shortcircuit.getBasicBlock();      OPT_BasicBlock mainBlock = 	myBlock.splitNodeWithLinksAt(shortcircuit, ir);      myBlock.insertOut(trueBlock);       // must come after the splitNodeAt      OPT_Instruction call;      OPT_RegisterOperand rhsType = 	InsertUnary(continueAt, ir, GET_TYPE_FROM_TIB, 		    OPT_ClassLoaderProxy.VM_Type_type, RHStib.copyD2U());      OPT_RegisterOperand callResult = ir.regpool.makeTempInt();      if (innermostElementType == VM_Type.JavaLangObjectType) {	OPT_IntConstantOperand lhsDimension = I(LHSArray.getDimensionality());	OPT_RegisterOperand rhsDimension = 	  getField(continueAt, ir, rhsType, VM_Entrypoints.dimensionField);	OPT_Instruction dimTest = 	  IfCmp2.create(INT_IFCMP2, oldGuard, rhsDimension, lhsDimension,			OPT_ConditionOperand.GREATER(), 			trueBlock.makeJumpTarget(),			new OPT_BranchProfileOperand(),			OPT_ConditionOperand.LESS(), 			falseBlock.makeJumpTarget(),			new OPT_BranchProfileOperand());	continueAt.insertBefore(dimTest);	OPT_BasicBlock testBlock = 	  mainBlock.splitNodeWithLinksAt(dimTest, ir);	mainBlock.insertOut(trueBlock);	mainBlock.insertOut(falseBlock);	OPT_RegisterOperand rhsInnermostElementType = 	  getField(continueAt,ir,rhsType.copyU2U(),VM_Entrypoints.innermostElementTypeField);	OPT_RegisterOperand rhsInnermostElementTypeDimension = 	  getField(continueAt, ir, rhsInnermostElementType, VM_Entrypoints.dimensionField);	continueAt.insertBefore(IfCmp.create(INT_IFCMP, oldGuard, 					     rhsInnermostElementTypeDimension,					     I(0),					     OPT_ConditionOperand.NOT_EQUAL(), 					     falseBlock.makeJumpTarget(),					     new OPT_BranchProfileOperand()));	return continueAt;      } else {	OPT_RegisterOperand lhsInnermostElementType = 	  getVMType(continueAt, ir, innermostElementType);	VM_Method target = 	  innermostElementType.isResolved() ? VM_Entrypoints.instanceOfArrayMethod : 	  VM_Entrypoints.instanceOfUnresolvedArrayMethod;	call = Call.create3(CALL, callResult, null, 			    OPT_MethodOperand.STATIC(target), 			    lhsInnermostElementType, 			    I(LHSArray.getDimensionality()), 			    rhsType);	call.copyPosition(continueAt);	continueAt.insertBefore(call);	call = _callHelper(call, ir);	continueAt.insertBefore(IfCmp.create(INT_IFCMP, oldGuard, 					     callResult.copyD2U(), I(0),					     OPT_ConditionOperand.EQUAL(), 					     falseBlock.makeJumpTarget(),					     new OPT_BranchProfileOperand()));	return continueAt;      }    }    OPT_OptimizingCompilerException.UNREACHABLE();    return null;  }