/// <summary> /// Add a branch from a location to a target label /// </summary> /// <param name="ilg"></param> /// <param name="target"></param> /// <remarks></remarks> public void AddBranch(FleeILGenerator ilg, Label target) { ILLocation startLoc = new ILLocation(ilg.Length); BranchInfo bi = new BranchInfo(startLoc, target); MyBranchInfos.Add(bi); }
/// <summary> /// Add a branch from a location to a target label /// </summary> /// <param name="ilg"></param> /// <param name="target"></param> /// <remarks></remarks> public void AddBranch(FleeILGenerator ilg, Label target) { ILLocation startLoc = new ILLocation(ilg.Length); BranchInfo bi = new BranchInfo(startLoc, target); // branches will be sorted in order MyBranchInfos.Add(bi); }
/// <summary> /// Determine if a branch from a point to a label will be long /// </summary> /// <param name="ilg"></param> /// <param name="target"></param> /// <returns></returns> /// <remarks></remarks> public bool IsLongBranch(FleeILGenerator ilg, Label target) { ILLocation startLoc = new ILLocation(ilg.Length); BranchInfo bi = new BranchInfo(startLoc, target); int index = MyBranchInfos.IndexOf(bi); bi = MyBranchInfos[index]; return(bi.IsLongBranch); }
/// <summary> /// Determine if a branch from a point to a label will be long /// </summary> /// <param name="ilg"></param> /// <param name="target"></param> /// <returns></returns> /// <remarks></remarks> public bool IsLongBranch(FleeILGenerator ilg, Label target) { //return true; ILLocation startLoc = new ILLocation(ilg.Length); BranchInfo bi = new BranchInfo(startLoc, target); int index = MyBranchInfos.IndexOf(bi); if (index > -1 && index < MyBranchInfos.Count) { bi = MyBranchInfos[index]; } return(bi.IsLongBranch); }
/// <summary> /// Determine if a branch from a point to a label will be long /// </summary> /// <param name="ilg"></param> /// <returns></returns> /// <remarks></remarks> public bool IsLongBranch(FleeILGenerator ilg) { ILLocation startLoc = new ILLocation(ilg.Length); foreach (var bi in MyBranchInfos) { if (bi.Equals(startLoc)) { return(bi.IsLongBranch); } } // we don't really know since this branch didn't exist. // we could throw an exceptio but // do a long branch to be safe. return(true); }
/// <summary> /// Determine if a branch from a point to a label will be long /// </summary> /// <param name="ilg"></param> /// <param name="target"></param> /// <returns></returns> /// <remarks></remarks> public bool IsLongBranch(FleeILGenerator ilg, Label target) { //return true; ILLocation startLoc = new ILLocation(ilg.Length); BranchInfo bi = new BranchInfo(startLoc, target); int index = MyBranchInfos.IndexOf(bi); if (index > -1 && index < MyBranchInfos.Count) { bi = MyBranchInfos[index]; return(bi.IsLongBranch); } else { return(true); // temp fix: not sure why, but MyBranchInfos seems to be missing elements when executing long scripts } }
public BranchInfo(ILLocation startLocation, Label endLabel) { _myStart = startLocation; _myLabel = endLabel; _myEnd = new ILLocation(); }
/// <summary> /// We only need to compare the start point. Can only have a single /// brach from the exact address, so if label doesn't match we have /// bigger problems. /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(ILLocation start) { return(_myStart.Equals1(start)); }