source: proto/s2k/trunk/framework/src/toolchain/b2k/lang/paramBuiltin/idisa/AbstractIDISABuiltinTranslator.java @ 4023

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

Restructured b2k package.

File size: 2.4 KB
Line 
1/** Builder Pattern - Abstract IDISA builtins target language builder.
2 *
3 * @author Ken Herdy <ksherdy at sfu dot ca>
4 */
5
6/*
7The definition of each operation must follow one of the below formats
8
9format_1(only for logic operations): opPattern = 2
10    simd_op(data_type arg, ...)
11format_2: opPattern = 0
12    class_name<fw>::op(data_type arg, ...)
13format_3: opPattern = 1
14    class_name<fw>::op<x>(data_type arg, ...)
15format_4: opPattern = 3
16    class_name::op(data_type arg, ...)
17format_5: opPattern = 4
18    class_name::op<x>(data_type arg, ...)
19
20format_6: specially for bitblock::store_[un]aligned
21        class_name::op(data_type arg, data_type* arg)
22format_7: specially for bitblock::load_[un]aligned
23        class_name::op(date_type *arg)         
24*/
25
26package toolchain.b2k.lang.paramBuiltin.idisa;
27
28import java.util.ArrayList;
29
30import toolchain.b2k.codeGenerator.util.CodeGeneratorUtil;
31
32public abstract class AbstractIDISABuiltinTranslator {
33       
34        protected String _firstArg;     
35       
36        protected String getArgCsv(String[] arguments, int start) {
37                ArrayList<String> argList = new ArrayList<String>();
38                for (String arg: arguments)
39                {
40                        for (String parts: arg.split(","))
41                        {
42                                argList.add(parts.trim());
43                        }
44                }
45                _firstArg = argList.get(0);
46               
47                String csv = CodeGeneratorUtil.makeDelimitedList(argList.subList(start, argList.size()), ",");
48                return csv;
49        }
50       
51        protected String getArgCsv(String[] arguments)
52        {
53                return getArgCsv(arguments, 0);
54        }       
55       
56        public abstract String makeIDISAFunctionCall0(String operationBaseName, String operationClassName, String fieldWidth, String ...arguments);
57        public abstract String makeIDISAFunctionCall1(String operationBaseName, String operationClassName, String fieldWidth, String ...arguments);
58        public abstract String makeIDISAFunctionCall2(String operationBaseName, String operationClassName, String fieldWidth, String ...arguments);
59        public abstract String makeIDISAFunctionCall3(String operationBaseName, String operationClassName, String fieldWidth, String ...arguments);
60        public abstract String makeIDISAFunctionCall4(String operationBaseName, String operationClassName, String fieldWidth, String ...arguments);
61        public abstract String makeIDISAFunctionCallStore(String operationBaseName, String operationClassName, String fieldWidth, String[] arguments);
62        public abstract String makeIDISAFunctionCallLoad(String operationBaseName, String operationClassName, String fieldWidth, String[] arguments);
63}
Note: See TracBrowser for help on using the repository browser.