Changeset 3245 for proto


Ignore:
Timestamp:
May 30, 2013, 5:20:44 PM (6 years ago)
Author:
shermer
Message:

Changed visitors to use PabloSBuiltin's initialValue field rather than making the decision themselves.
Temporarily added comments to PabloSBuiltin values indicating where outside PabloSBuiltin these values
are referenced.

Location:
proto/pabloj/trunk/src/toolchain/pabloS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/pabloj/trunk/src/toolchain/pabloS/lang/PabloSBuiltin.java

    r3244 r3245  
    1111
    1212public enum PabloSBuiltin {
    13     ADVANCE(               "Advance",             CarryType.One, CARRY_TRANSLATION,  sig_S_S()  ),
     13    ADVANCE(               "Advance",             CarryType.One, CARRY_TRANSLATION,  sig_S_S()  ), // BuiltinCallUtil, CombineAdvances
    1414    SCAN_TO_FIRST(         "ScanToFirst",         CarryType.One, CARRY_TRANSLATION,  sig_S_S(),  InitialValue.One ),
    15     SCAN_THRU(             "ScanThru",            CarryType.One, CARRY_TRANSLATION,  sig_SS_S() ),
     15    SCAN_THRU(             "ScanThru",            CarryType.One, CARRY_TRANSLATION,  sig_SS_S() ), // BuiltinTranslator
    1616    SCAN_TO(               "ScanTo",              CarryType.One, SCANTO_TRANSLATION, sig_SS_S() ),
    1717    SPAN_UP_TO(            "SpanUpTo",            CarryType.One, CARRY_TRANSLATION,  sig_SS_S() ),
     
    1919    EXCLUSIVE_SPAN(        "ExclusiveSpan",       CarryType.One, CARRY_TRANSLATION,  sig_SS_S() ),
    2020    ADVANCE_THEN_SCAN_THRU("AdvanceThenScanThru", CarryType.One, CARRY_TRANSLATION,  sig_SS_S()  ),
    21     ADVANCE_THEN_SCAN_TO(  "AdvanceThenScanTo",   CarryType.One, ADVANCE_THEN_SCANTO_TRANSLATION, sig_SS_S()  ),
     21    ADVANCE_THEN_SCAN_TO(  "AdvanceThenScanTo",   CarryType.One, ADVANCE_THEN_SCANTO_TRANSLATION, sig_SS_S()  ), // BuiltinTranslator
    2222   
    23     ADVANCE_N(    "AdvanceN",  CarryType.N,    ADVANCEN_TRANSLATION, sig_SI_S() ),  
     23    ADVANCE_N(    "AdvanceN",  CarryType.N,    ADVANCEN_TRANSLATION, sig_SI_S() ), // AdvNCounterVisitor  
    2424    ADVANCE_32(   "Advance32", CarryType.N,    CARRY_TRANSLATION,    sig_S_S()  ),
    2525
    26     MASK(         "Mask",      CarryType.None, MASK_TRANSLATION,     sig_II_S() ),    
     26    MASK(         "Mask",      CarryType.None, MASK_TRANSLATION,     sig_II_S() ), // visitors.carry.Counter    
    2727    AT_EOF(       "atEOF",     CarryType.None, ATEOF_TRANSLATION,    sig_S_S()  ),
    2828    IN_FILE(      "inFile",    CarryType.None, INFILE_TRANSLATION,   sig_S_S()  ),
    29     ASSERT_ZERO(  "assert_0",  CarryType.None, CARRY_TRANSLATION,    sig_ST_V() ),     
    30     EOF_MASK(     "EOF_mask",  CarryType.None, CARRY_TRANSLATION,    sig_V_S()  ), // deprecated
     29    ASSERT_ZERO(  "assert_0",  CarryType.None, CARRY_TRANSLATION,    sig_ST_V() ), // surroundAssert0sWithIfs   
     30    EOF_MASK(     "EOF_mask",  CarryType.None, CARRY_TRANSLATION,    sig_V_S()  ), // deprecated, // PabloS.ast.Generators
    3131    NULL_BUILTIN( "NULL",      CarryType.None, CARRY_TRANSLATION,    sig_V_V()  );
    3232
     
    110110        public final boolean isCarry1() { return carryType == CarryType.One; }
    111111        public final boolean isCarryN() { return carryType == CarryType.N; }
     112        public final BuiltinTranslator getTranslator() { return translator; }
    112113        public final InitialValue getInitialValue() { return initialValue; }
    113         public final BuiltinTranslator getTranslator() { return translator; }
     114        public final int intInitialValue() { return (initialValue == InitialValue.One) ? 1 : 0; }
     115       
    114116}
  • proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/carry/CarryInfoSetVisitor.java

    r3233 r3245  
    4444                       
    4545                        if(BuiltinCallUtil.isCarry1(node)) {
    46                                 if (BuiltinCallUtil.isBuiltInCall(node, PabloSBuiltin.SCAN_TO_FIRST)) {
    47                                         ((CarryInfoSetSymbol)symbolTable.get(key)).addCarry1(1);
    48                                 } else {
    49                                         ((CarryInfoSetSymbol)symbolTable.get(key)).addCarry1(0);
    50                                 }
     46                                PabloSBuiltin builtin = BuiltinCallUtil.builtin(node);
     47                                int initializer = builtin.intInitialValue();
     48                               
     49                                CarryInfoSetSymbol symbol = (CarryInfoSetSymbol)symbolTable.get(key);
     50                                symbol.addCarry1(initializer);
    5151                        }
    5252                       
Note: See TracChangeset for help on using the changeset viewer.