Example #1
0
        //------------------------------------------------------------
        // OpFormat.SR1_CTI形式のコンストラクタ。
        public BCOpCode(OpType aOp, StackRegister aSR1, BCConstantValue aCV)
        {
            // 設定
            mFormat        = OpFormat.SR1_CTI;
            mOp            = aOp;
            mSR1           = aSR1;
            mConstantValue = aCV;

            // チェック
            checkOpAndFormat();
        }
Example #2
0
        //------------------------------------------------------------
        // 適切なConstantValueを取得する。
        public BCConstantValue CheckAndGet(BCConstantValue aValue)
        {
            // 既に存在していればそれを取得する
            foreach (var entry in mList)
            {
                if (entry.Equals(aValue))
                {// あった
                    return(entry);
                }
            }

            // なければ追加してそれを返す
            mList.Add(aValue);
            return(aValue);
        }
Example #3
0
        //------------------------------------------------------------
        // 等しいか。
        public bool Equals(BCConstantValue aRHS)
        {
            // 種類チェック
            if (mKind != aRHS.mKind)
            {
                return(false);
            }

            // 種類ごとのチェック
            switch (mKind)
            {
            case Kind.SInt32: return(mValSInt32 == aRHS.mValSInt32);

            default:
                Assert.NotReachHere();
                return(false);
            }
        }
Example #4
0
 //------------------------------------------------------------
 // 適切なConstantValueを取得する。
 public BCConstantValue GetConstantValue(BCConstantValue aValue)
 {
     return(mConstantValueTable.CheckAndGet(aValue));
 }