Changeset 3369


Ignore:
Timestamp:
Jun 27, 2013, 4:35:54 PM (6 years ago)
Author:
ksherdy
Message:

Mirgated to pure IDISA calls.

Location:
proto/pabloj/trunk
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • proto/pabloj/trunk/input/test/pabloB/test.pablob

    r3368 r3369  
    1919        BitBlock r;
    2020
    21         r = simd.constant<1>(0);
     21        r = bitblock.any<128>(a);
    2222       
    2323        /*
  • proto/pabloj/trunk/output/cpplang/idisa_definitions.hpp

    r3368 r3369  
    7171                BitBlock k;
    7272                BitBlock r;
    73                 r = simd<1>::constant<0>();
     73                r = bitblock::any(a);
    7474        }
    7575       
  • proto/pabloj/trunk/src/test/pabloS/PabloSTestHarness.java

    r3357 r3369  
    3030import toolchain.pabloS.transformer.visitors.pabloS2PabloB.CarryIntroXFormer;
    3131import toolchain.pabloS.transformer.visitors.pabloS2PabloB.Context;
    32 import toolchain.pabloS.transformer.visitors.pabloS2PabloB.BitwiseBoolean2IDISA;
    3332import toolchain.pabloS.transformer.visitors.pabloS2pabloS.CombineAdvances;
    3433import toolchain.pabloS.transformer.visitors.pabloS2pabloS.ExpandAugmentedAssignments;
     
    4443        public enum VisitorsUnderTest {
    4544            COMBINE_ADVANCES(CombineAdvances.class, "CombineAdvances"),
    46             CONVERT_BITWISE_BOOLEAN_TO_IDISA_CALLS(BitwiseBoolean2IDISA.class, "ConvertBitwiseBooleanToIDISACalls"),
     45            // CONVERT_BITWISE_BOOLEAN_TO_IDISA_CALLS(BitwiseBoolean2IDISA.class, "ConvertBitwiseBooleanToIDISACalls"),
    4746            EXPAND_AUGMENTED_ASSIGNMENTS(ExpandAugmentedAssignments.class, "ExpandAugmentedAssignments");           
    4847            //CARRY_INTRO_XFORMER_FINAL_BLOCK(CarryIntroXFormer.class, "CarryIntroXFormerFinalBlock"),
  • proto/pabloj/trunk/src/toolchain/pabloB/ast/Generators.java

    r3368 r3369  
    158158        //////////////////////////////////////////////////////////////////////////
    159159        // IDISA function calls
    160     public static IdisaFuncCallNode makeIdisaFuncCallNode(Locator locator, String pckage, String name, int fw, ASTNode... args ) {
    161         CompoundIdentifierNode identifier = Generators.makeCompoundIdentifierNode(locator, pckage, name);   
     160       
     161        public static IdisaFuncCallNode makeIdisaFuncCallNode(Locator locator, IDISABuiltin builtin, int fw, ASTNode... args ) {
     162            String packageName = builtin.packageName();
     163            String baseName = builtin.baseName();
     164            return makeIdisaFuncCallNode(locator, packageName, baseName, fw, args);
     165    }
     166       
     167    public static IdisaFuncCallNode makeIdisaFuncCallNode(Locator locator, String packageName, String baseName, int fw, ASTNode... args ) {
     168        CompoundIdentifierNode identifier = Generators.makeCompoundIdentifierNode(locator, packageName, baseName);   
    162169        FieldWidthNode fieldWidth = Generators.makeIdisaFieldWidthNode(locator, fw);
    163170        IdisaFuncCallNode idisaFuncCall = Generators.makeIdisaFuncCallNode(locator, identifier, fieldWidth, args);
  • proto/pabloj/trunk/src/toolchain/pabloB/lang/idisa/IDISABuiltin.java

    r3368 r3369  
    158158        }
    159159       
    160         public String pckageName() {
     160        public String packageName() {
    161161            return this.name().toLowerCase().split("_")[0];
    162162        }
  • proto/pabloj/trunk/src/toolchain/pabloB/lang/types/PrimitiveType.java

    r3032 r3369  
    3434        };
    3535
    36         public static final int BITBLOCK_SIZE = 256;
     36        public static final int BITBLOCK_SIZE = 128; // TODO - KH: hoist to application level
    3737        private static final boolean ALL_TYPES_ACCEPT_ERROR_TYPES = true;
    3838               
  • proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/pabloS2PabloB/PabloS2PabloBXFormer.java

    r3368 r3369  
    1616import pabloB.ast.*;
    1717import pabloB.inputHandler.*;
    18 import pabloB.tokens.Token;
    1918import toolchain.pabloB.lang.KernelState;
    2019import toolchain.pabloB.ast.Accessors;
    2120import toolchain.pabloB.ast.Generators;
    22 import toolchain.pabloB.lang.idisa.IDISABitBlockBuiltins;
    23 import toolchain.pabloB.lang.idisa.IDISABuiltin;
    24 import toolchain.pabloB.lang.idisa.IDISASIMDBitwiseBuiltins;
    25 import static toolchain.pabloB.lang.idisa.IDISASIMDBitwiseBuiltins.*;
     21import static toolchain.pabloB.lang.types.PrimitiveType.BITBLOCK_SIZE;
     22import static toolchain.pabloB.lang.idisa.IDISABuiltin.*;
    2623
    2724// non-conflicting pabloS imports
     
    251248               
    252249                Locator locator = Generators.makeToken(snode.getToken());
    253                 ASTNode replacement = makeAssert0Call(locator, childResults);
    254            
    255                 return replacement;
    256             }
    257            
    258             if(BuiltinCallUtil.isMask(snode)) { // translates pablo.Mask(fw,constant) to an IDISA call
     250                return makeAssert0Call(locator, childResults);
     251            }
     252           
     253            if(BuiltinCallUtil.isMask(snode)) {
    259254                Locator locator = Generators.makeToken(snode.getToken());
    260                
    261              
    262               int fw            = Integer.valueOf(toolchain.pabloS.ast.Accessors.argument(snode, 0).getToken().getLexeme());
    263               int value         = Integer.valueOf(toolchain.pabloS.ast.Accessors.argument(snode, 1).getToken().getLexeme());
    264               IntegerConstantNode valueNode = Generators.makeIntegerConstantNode(locator, value);
    265              
    266               ASTNode replacement = Generators.makeIdisaFuncCallNode(locator, IDISABuiltin.SIMD_CONSTANT.pckageName(), IDISABuiltin.SIMD_CONSTANT.baseName(), fw, valueNode);
    267               return replacement;
     255                return makeAllZeroesCall(snode, locator);
    268256
    269257            } else {
     
    274262                return replacment;
    275263            }
     264        }
     265
     266        private ASTNode makeAllZeroesCall(pabloS.ast.FuncCallNode snode, Locator locator) {
     267           
     268            String idisaPackage = SIMD_CONSTANT.packageName();
     269            String idisaOperation = SIMD_CONSTANT.baseName();
     270
     271            int fw            = Integer.valueOf(toolchain.pabloS.ast.Accessors.argument(snode, 0).getToken().getLexeme());
     272            int value         = Integer.valueOf(toolchain.pabloS.ast.Accessors.argument(snode, 1).getToken().getLexeme());
     273            IntegerConstantNode valueNode = Generators.makeIntegerConstantNode(locator, value);
     274           
     275            ASTNode replacement = Generators.makeIdisaFuncCallNode(locator, idisaPackage, idisaOperation, fw, valueNode);
     276            return replacement;
    276277        }
    277278
     
    339340                ASTNode lhs = childResults.get(0);
    340341                ASTNode rhs = childResults.get(1);
    341 
     342               
    342343                if(tokenS.isLextant(pabloS.lexicalAnalyzer.Lextant.OR)) {
    343                     replacement = makeIDISACall(locator, OR, Generators.arguments(lhs, rhs));
     344                    replacement = Generators.makeIdisaFuncCallNode(locator, SIMD_OR, BITBLOCK_SIZE, Generators.arguments(lhs, rhs));
    344345                }
    345346                else if(tokenS.isLextant(pabloS.lexicalAnalyzer.Lextant.AND)) {
    346347                    // TS: this optimization seems inappropriate for pabloS to handle.     
    347348                    if (rhsS.getToken().isLextant(pabloS.lexicalAnalyzer.Lextant.NOT)) {                       
    348                         replacement =  makeIDISACall(locator,
    349                                 ANDC,
    350                                 Generators.arguments(lhs, rhs.child(1)));
     349                        replacement =  Generators.makeIdisaFuncCallNode(locator, SIMD_ANDC, BITBLOCK_SIZE,
     350                                Generators.arguments(lhs, Accessors.idisaFuncCallArgListNode((IdisaFuncCallNode)rhs).child(0)));
    351351                    }
    352352                    else if(lhsS.getToken().isLextant(pabloS.lexicalAnalyzer.Lextant.NOT)) {
    353                         replacement =  makeIDISACall(locator,
    354                                 ANDC,
    355                                 Generators.arguments(rhs, lhs.child(1)));
     353                        replacement =  Generators.makeIdisaFuncCallNode(locator, SIMD_ANDC, BITBLOCK_SIZE,
     354                                Generators.arguments(rhs, Accessors.idisaFuncCallArgListNode((IdisaFuncCallNode)lhs).child(0)));
    356355                    }
    357356                    else {
    358                         replacement =  makeIDISACall(locator, AND, Generators.arguments(lhs, rhs));                       
     357                        replacement =  Generators.makeIdisaFuncCallNode(locator, SIMD_AND, BITBLOCK_SIZE, Generators.arguments(lhs, rhs));   
    359358                    }
    360359                }
    361360                else if (tokenS.isLextant(pabloS.lexicalAnalyzer.Lextant.XOR)){
    362                     replacement = makeIDISACall(locator, XOR, Generators.arguments(lhs, rhs));
     361                    replacement = Generators.makeIdisaFuncCallNode(locator, SIMD_XOR, BITBLOCK_SIZE, Generators.arguments(lhs, rhs));
    363362                } else {
    364363                    assert false : "PabloS to PabloB binary operator translation not implemented.";
     
    378377                pabloB.inputHandler.TextLocation locator = Generators.makeTextLocation(token.getLocation());
    379378                pabloB.ast.ASTNode operand = childResults.get(0);
    380                 replacement = makeIDISACall(locator, NOT, Generators.arguments(operand));
     379                replacement = Generators.makeIdisaFuncCallNode(locator, SIMD_NOT, BITBLOCK_SIZE, Generators.arguments(operand));
    381380            } else {
    382381                assert false : "PabloS to PabloB unary operator translation not implemented.";
     
    391390            pabloB.ast.IfStmtNode replacement = new pabloB.ast.IfStmtNode(pabloBToken);
    392391            appendChildResults(replacement, childResults);
    393 
    394            
    395            
    396            
    397            
    398            
    399392           
    400393            surroundConditionWithBitBlockAny(replacement, Accessors.condition(replacement));
     
    417410    private static void surroundConditionWithBitBlockAny(ASTNode node, pabloB.ast.ASTNode condition) {
    418411        Locator locator = node;
    419         FuncCallNode funcCallNode = makeIDISACall(locator, IDISABitBlockBuiltins.ANY, Generators.arguments(condition.deepCopy()));
    420         node.replaceChild(condition, funcCallNode);
    421     }
    422 
    423     private static FuncCallNode makeIDISACall(Locator locator, IDISASIMDBitwiseBuiltins idisaBuiltin, pabloB.ast.ASTNode ... arguments) {
    424         return Generators.makeFuncCallNode(locator, idisaBuiltin.Name(), arguments);
    425     }
    426    
    427     private static FuncCallNode makeIDISACall(Locator locator, IDISABitBlockBuiltins idisaBuiltin, ASTNode[] arguments) {
    428         return Generators.makeFuncCallNode(locator, idisaBuiltin.IDISALexeme(), arguments);
     412       
     413        String idisaPackage = BITBLOCK_ANY.packageName();
     414        String idisaOperation = BITBLOCK_ANY.baseName();
     415       
     416        int fw = BITBLOCK_SIZE;
     417       
     418        ASTNode replacement = Generators.makeIdisaFuncCallNode(locator, idisaPackage, idisaOperation, fw, Generators.arguments(condition.deepCopy()));
     419       
     420        node.replaceChild(condition, replacement);
    429421    }
    430422
Note: See TracChangeset for help on using the changeset viewer.