1 using System;
2
3
4
5 namespace IntermediateCodeKeywords
6 {
7 internal class Keywords
8 {
9 static Keywords() :
10 instance(new Keywords())
11 {
12 }
13 public static Keywords& Instance()
14 {
15 return *instance;
16 }
17 public System.Lex.KeywordMap* GetKeywordMap()
18 {
19 return keywordMap.Get();
20 }
21 private Keywords()
22 {
23 System.Lex.Keyword keyword0(u"cu", IntermediateCodeTokens.CU);
24 keywordList.Add(keyword0);
25 System.Lex.Keyword keyword1(u"types", IntermediateCodeTokens.TYPES);
26 keywordList.Add(keyword1);
27 System.Lex.Keyword keyword2(u"data", IntermediateCodeTokens.DATA);
28 keywordList.Add(keyword2);
29 System.Lex.Keyword keyword3(u"function", IntermediateCodeTokens.FUNCTION);
30 keywordList.Add(keyword3);
31 System.Lex.Keyword keyword4(u"once", IntermediateCodeTokens.ONCE);
32 keywordList.Add(keyword4);
33 System.Lex.Keyword keyword5(u"store", IntermediateCodeTokens.STORE);
34 keywordList.Add(keyword5);
35 System.Lex.Keyword keyword6(u"arg", IntermediateCodeTokens.ARG);
36 keywordList.Add(keyword6);
37 System.Lex.Keyword keyword7(u"jmp", IntermediateCodeTokens.JMP);
38 keywordList.Add(keyword7);
39 System.Lex.Keyword keyword8(u"branch", IntermediateCodeTokens.BRANCH);
40 keywordList.Add(keyword8);
41 System.Lex.Keyword keyword9(u"call", IntermediateCodeTokens.CALL);
42 keywordList.Add(keyword9);
43 System.Lex.Keyword keyword10(u"ret", IntermediateCodeTokens.RET);
44 keywordList.Add(keyword10);
45 System.Lex.Keyword keyword11(u"switch", IntermediateCodeTokens.SWITCH);
46 keywordList.Add(keyword11);
47 System.Lex.Keyword keyword12(u"nop", IntermediateCodeTokens.NOP);
48 keywordList.Add(keyword12);
49 System.Lex.Keyword keyword13(u"save", IntermediateCodeTokens.SAVE);
50 keywordList.Add(keyword13);
51 System.Lex.Keyword keyword14(u"not", IntermediateCodeTokens.NOT);
52 keywordList.Add(keyword14);
53 System.Lex.Keyword keyword15(u"neg", IntermediateCodeTokens.NEG);
54 keywordList.Add(keyword15);
55 System.Lex.Keyword keyword16(u"signextend", IntermediateCodeTokens.SIGNEXTEND);
56 keywordList.Add(keyword16);
57 System.Lex.Keyword keyword17(u"zeroextend", IntermediateCodeTokens.ZEROEXTEND);
58 keywordList.Add(keyword17);
59 System.Lex.Keyword keyword18(u"truncate", IntermediateCodeTokens.TRUNCATE);
60 keywordList.Add(keyword18);
61 System.Lex.Keyword keyword19(u"bitcast", IntermediateCodeTokens.BITCAST);
62 keywordList.Add(keyword19);
63 System.Lex.Keyword keyword20(u"inttofloat", IntermediateCodeTokens.INTTOFLOAT);
64 keywordList.Add(keyword20);
65 System.Lex.Keyword keyword21(u"floattoint", IntermediateCodeTokens.FLOATTOINT);
66 keywordList.Add(keyword21);
67 System.Lex.Keyword keyword22(u"inttoptr", IntermediateCodeTokens.INTTOPTR);
68 keywordList.Add(keyword22);
69 System.Lex.Keyword keyword23(u"ptrtoint", IntermediateCodeTokens.PTRTOINT);
70 keywordList.Add(keyword23);
71 System.Lex.Keyword keyword24(u"add", IntermediateCodeTokens.ADD);
72 keywordList.Add(keyword24);
73 System.Lex.Keyword keyword25(u"sub", IntermediateCodeTokens.SUB);
74 keywordList.Add(keyword25);
75 System.Lex.Keyword keyword26(u"mul", IntermediateCodeTokens.MUL);
76 keywordList.Add(keyword26);
77 System.Lex.Keyword keyword27(u"div", IntermediateCodeTokens.DIV);
78 keywordList.Add(keyword27);
79 System.Lex.Keyword keyword28(u"mod", IntermediateCodeTokens.MOD);
80 keywordList.Add(keyword28);
81 System.Lex.Keyword keyword29(u"and", IntermediateCodeTokens.AND);
82 keywordList.Add(keyword29);
83 System.Lex.Keyword keyword30(u"or", IntermediateCodeTokens.OR);
84 keywordList.Add(keyword30);
85 System.Lex.Keyword keyword31(u"xor", IntermediateCodeTokens.XOR);
86 keywordList.Add(keyword31);
87 System.Lex.Keyword keyword32(u"shl", IntermediateCodeTokens.SHL);
88 keywordList.Add(keyword32);
89 System.Lex.Keyword keyword33(u"shr", IntermediateCodeTokens.SHR);
90 keywordList.Add(keyword33);
91 System.Lex.Keyword keyword34(u"equal", IntermediateCodeTokens.EQUAL);
92 keywordList.Add(keyword34);
93 System.Lex.Keyword keyword35(u"less", IntermediateCodeTokens.LESS);
94 keywordList.Add(keyword35);
95 System.Lex.Keyword keyword36(u"param", IntermediateCodeTokens.PARAM);
96 keywordList.Add(keyword36);
97 System.Lex.Keyword keyword37(u"local", IntermediateCodeTokens.LOCAL);
98 keywordList.Add(keyword37);
99 System.Lex.Keyword keyword38(u"load", IntermediateCodeTokens.LOAD);
100 keywordList.Add(keyword38);
101 System.Lex.Keyword keyword39(u"elemaddr", IntermediateCodeTokens.ELEMADDR);
102 keywordList.Add(keyword39);
103 System.Lex.Keyword keyword40(u"ptroffset", IntermediateCodeTokens.PTROFFSET);
104 keywordList.Add(keyword40);
105 System.Lex.Keyword keyword41(u"ptrdiff", IntermediateCodeTokens.PTRDIFF);
106 keywordList.Add(keyword41);
107 System.Lex.Keyword keyword42(u"trap", IntermediateCodeTokens.TRAP);
108 keywordList.Add(keyword42);
109 System.Lex.Keyword keyword43(u"type", IntermediateCodeTokens.TYPE);
110 keywordList.Add(keyword43);
111 System.Lex.Keyword keyword44(u"offset", IntermediateCodeTokens.OFFSET);
112 keywordList.Add(keyword44);
113 System.Lex.Keyword keyword45(u"size", IntermediateCodeTokens.SIZE);
114 keywordList.Add(keyword45);
115 System.Lex.Keyword keyword46(u"alignment", IntermediateCodeTokens.ALIGNMENT);
116 keywordList.Add(keyword46);
117 System.Lex.Keyword keyword47(u"void", IntermediateCodeTokens.VOID);
118 keywordList.Add(keyword47);
119 System.Lex.Keyword keyword48(u"bool", IntermediateCodeTokens.BOOL);
120 keywordList.Add(keyword48);
121 System.Lex.Keyword keyword49(u"sbyte", IntermediateCodeTokens.SBYTE);
122 keywordList.Add(keyword49);
123 System.Lex.Keyword keyword50(u"byte", IntermediateCodeTokens.BYTE);
124 keywordList.Add(keyword50);
125 System.Lex.Keyword keyword51(u"short", IntermediateCodeTokens.SHORT);
126 keywordList.Add(keyword51);
127 System.Lex.Keyword keyword52(u"ushort", IntermediateCodeTokens.USHORT);
128 keywordList.Add(keyword52);
129 System.Lex.Keyword keyword53(u"int", IntermediateCodeTokens.INT);
130 keywordList.Add(keyword53);
131 System.Lex.Keyword keyword54(u"uint", IntermediateCodeTokens.UINT);
132 keywordList.Add(keyword54);
133 System.Lex.Keyword keyword55(u"long", IntermediateCodeTokens.LONG);
134 keywordList.Add(keyword55);
135 System.Lex.Keyword keyword56(u"ulong", IntermediateCodeTokens.ULONG);
136 keywordList.Add(keyword56);
137 System.Lex.Keyword keyword57(u"float", IntermediateCodeTokens.FLOAT);
138 keywordList.Add(keyword57);
139 System.Lex.Keyword keyword58(u"double", IntermediateCodeTokens.DOUBLE);
140 keywordList.Add(keyword58);
141 System.Lex.Keyword keyword59(u"true", IntermediateCodeTokens.TRUE);
142 keywordList.Add(keyword59);
143 System.Lex.Keyword keyword60(u"false", IntermediateCodeTokens.FALSE);
144 keywordList.Add(keyword60);
145 System.Lex.Keyword keyword61(u"null", IntermediateCodeTokens.NULL);
146 keywordList.Add(keyword61);
147 System.Lex.Keyword keyword62(u"conv", IntermediateCodeTokens.CONV);
148 keywordList.Add(keyword62);
149 System.Lex.Keyword keyword63(u"metadata", IntermediateCodeTokens.METADATA);
150 keywordList.Add(keyword63);
151 System.Lex.Keyword nullKeyword(null, -1);
152 keywordList.Add(nullKeyword);
153 keywordMap.Reset(new System.Lex.KeywordMap(keywordList.CBegin().Ptr()));
154 }
155 private static System.UniquePtr<Keywords> instance;
156 private System.Collections.List<System.Lex.Keyword> keywordList;
157 private System.UniquePtr<System.Lex.KeywordMap> keywordMap;
158 }
159
160 public System.Lex.KeywordMap* GetKeywordMap()
161 {
162 return Keywords.Instance().GetKeywordMap();
163 }
164 }