Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        /// <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);
        }
Ejemplo n.º 6
0
        /// <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
            }
        }
Ejemplo n.º 7
0
 public BranchInfo(ILLocation startLocation, Label endLabel)
 {
     _myStart = startLocation;
     _myLabel = endLabel;
     _myEnd   = new ILLocation();
 }
Ejemplo n.º 8
0
 /// <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));
 }