source: proto/s2k/trunk/framework/src/toolchain/b2k/lang/carrySet/CarrySetBuiltin2CPP.java @ 3817

Last change on this file since 3817 was 3817, checked in by ksherdy, 4 years ago

Moved carrySet from s2k to b2k.

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 toolchain.b2k.lang.carrySet;
8
9import java.util.HashMap;
10import java.util.Map;
11
12
13public class CarrySetBuiltin2CPP extends CarrySetEncoder {
14       
15        private static Map<CarrySetBuiltin, String> carry2CPPCode;
16       
17    static {
18       
19        carry2CPPCode = new HashMap<CarrySetBuiltin, String>();
20        carry2CPPCode.put(CarrySetBuiltin.CARRYDECLARE, "CarryDeclare");              // macros
21        carry2CPPCode.put(CarrySetBuiltin.LOCALCARRYCOMBINE,"LocalCarryCombine");       
22        carry2CPPCode.put(CarrySetBuiltin.CARRYRANGE,"carryRange");                   // members
23        carry2CPPCode.put(CarrySetBuiltin.GETCARRY,"getCarry");
24        carry2CPPCode.put(CarrySetBuiltin.SETCARRY,"setCarry");
25        carry2CPPCode.put(CarrySetBuiltin.PENDING64,"getPending64");
26        carry2CPPCode.put(CarrySetBuiltin.CARRYADJUST,"carryAdjust");
27        carry2CPPCode.put(CarrySetBuiltin.CARRYDEQUEUEENQUEUE,"carryDequeueEnqueue");
28        carry2CPPCode.put(CarrySetBuiltin.CARRYFLIP,"carryFlip");
29       
30        for(CarrySetBuiltin op : CarrySetBuiltin.values()) {
31                if(!carry2CPPCode.containsKey(op)) {
32                                throw new RuntimeException("CarrySet to CPP code mapping unimplemented :" + CarrySetBuiltin2CPP.class.getSimpleName());
33                }
34        }
35    }
36   
37        public String getName(CarrySetBuiltin op) {                     
38                return carry2CPPCode.get(op);
39        }
40       
41}
Note: See TracBrowser for help on using the repository browser.