source: proto/pabloj/trunk/src/compilers/pabloB/lang/carrySet/CarrySetBuiltins2CPP.java @ 2990

Last change on this file since 2990 was 2990, checked in by ksherdy, 5 years ago

Eliminated all carry 'strings' from the PabloS parser.

File size: 1.4 KB
Line 
1/*
2 * Maps carry set builtins to C++ macro name.
3 *
4 * @author <ksherdy at sfu dot ca>
5 */
6
7package compilers.pabloB.lang.carrySet;
8
9import java.util.HashMap;
10import java.util.Map;
11
12public class CarrySetBuiltins2CPP extends CarrySetBuiltins2Lang {
13       
14        private static Map<CarrySetBuiltins, String> carry2CPPCode;
15       
16    static {
17       
18        carry2CPPCode = new HashMap<CarrySetBuiltins, String>();
19        carry2CPPCode.put(CarrySetBuiltins.CARRYDECLARE, "CarryDeclare");
20        carry2CPPCode.put(CarrySetBuiltins.CARRYRANGE,"CarryRange");
21        carry2CPPCode.put(CarrySetBuiltins.GETCARRY,"GetCarry");
22        carry2CPPCode.put(CarrySetBuiltins.SETCARRY,"SetCarry");
23        carry2CPPCode.put(CarrySetBuiltins.PENDING64,"Pending64");
24        carry2CPPCode.put(CarrySetBuiltins.LOCALCARRYCOMBINE,"LocalCarryCombine");
25        carry2CPPCode.put(CarrySetBuiltins.CARRYADJUST,"CarryAdjust");
26        carry2CPPCode.put(CarrySetBuiltins.CARRYDEQUEUEENQUEUE,"CarryDequeueEnqueue");
27        carry2CPPCode.put(CarrySetBuiltins.CARRYFLIP,"CarryFlip");
28        //carry2CPPCode.put(CarrySetBuiltins.VALUEOF,"cq[%s]");
29       
30        for(CarrySetBuiltins op : CarrySetBuiltins.values()) {
31                if(!carry2CPPCode.containsKey(op)) {
32                                throw new RuntimeException("CarrySet to CPP code mapping unimplemented :" + CarrySetBuiltins2CPP.class.getSimpleName());
33                }
34        }
35    }
36   
37        public String getCode(CarrySetBuiltins op) {                   
38                return carry2CPPCode.get(op);
39        }
40       
41}
Note: See TracBrowser for help on using the repository browser.