16 #ifndef __SLGHPATEXPRESS__ 17 #define __SLGHPATEXPRESS__ 19 #include "slghpattern.hh" 23 vector<Token *> toklist;
26 static PatternBlock *buildSingle(int4 startbit,int4 endbit,uintm byteval);
27 static PatternBlock *buildBigBlock(int4 size,int4 bitstart,int4 bitend,intb value);
28 static PatternBlock *buildLittleBlock(int4 size,int4 bitstart,int4 bitend,intb value);
40 void setLeftEllipsis(
bool val) { leftellipsis = val; }
41 void setRightEllipsis(
bool val) { rightellipsis = val; }
42 bool getLeftEllipsis(
void)
const {
return leftellipsis; }
43 bool getRightEllipsis(
void)
const {
return rightellipsis; }
48 Pattern *getPattern(
void)
const {
return pattern; }
49 int4 getMinimumLength(
void)
const;
50 bool alwaysTrue(
void)
const {
return pattern->alwaysTrue(); }
51 bool alwaysFalse(
void)
const {
return pattern->alwaysFalse(); }
52 bool alwaysInstructionTrue(
void)
const {
return pattern->alwaysInstructionTrue(); }
64 virtual TokenPattern genMinPattern(
const vector<TokenPattern> &ops)
const=0;
65 virtual void listValues(vector<const PatternValue *> &list)
const=0;
66 virtual void getMinMax(vector<intb> &minlist,vector<intb> &maxlist)
const=0;
67 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const=0;
68 virtual void saveXml(ostream &s)
const=0;
70 intb getSubValue(
const vector<intb> &replace) {
72 return getSubValue(replace,listpos); }
73 void layClaim(
void) { refcount += 1; }
81 virtual void listValues(vector<const PatternValue *> &list)
const { list.push_back(
this); }
82 virtual void getMinMax(vector<intb> &minlist,vector<intb> &maxlist)
const {
83 minlist.push_back(minValue()); maxlist.push_back(maxValue()); }
84 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const {
return replace[listpos++]; }
85 virtual intb minValue(
void)
const=0;
86 virtual intb maxValue(
void)
const=0;
94 int4 bytestart,byteend;
102 virtual intb minValue(
void)
const {
return 0; }
103 virtual intb maxValue(
void)
const { intb res=0; res=~res;
zero_extend(res,bitend-bitstart);
return res; }
104 virtual void saveXml(ostream &s)
const;
109 int4 startbit,endbit;
110 int4 startbyte,endbyte;
116 int4 getStartBit(
void)
const {
return startbit; }
117 int4 getEndBit(
void)
const {
return endbit; }
118 bool getSignBit(
void)
const {
return signbit; }
122 virtual intb minValue(
void)
const {
return 0; }
123 virtual intb maxValue(
void)
const { intb res=0; res=~res;
zero_extend(res,(endbit-startbit));
return res; }
124 virtual void saveXml(ostream &s)
const;
133 virtual intb getValue(
ParserWalker &walker)
const {
return val; }
136 virtual intb minValue(
void)
const {
return val; }
137 virtual intb maxValue(
void)
const {
return val; }
138 virtual void saveXml(ostream &s)
const;
149 virtual intb minValue(
void)
const {
return (intb)0; }
150 virtual intb maxValue(
void)
const {
return (intb)0; }
151 virtual void saveXml(ostream &s)
const { s <<
"<start_exp/>"; }
162 virtual intb minValue(
void)
const {
return (intb)0; }
163 virtual intb maxValue(
void)
const {
return (intb)0; }
164 virtual void saveXml(ostream &s)
const { s <<
"<end_exp/>"; }
176 void changeIndex(int4 newind) { index = newind; }
177 bool isConstructorRelative(
void)
const;
178 const string &getName(
void)
const;
180 virtual TokenPattern genMinPattern(
const vector<TokenPattern> &ops)
const {
return ops[index]; }
182 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
183 virtual intb minValue(
void)
const;
184 virtual intb maxValue(
void)
const;
185 virtual void saveXml(ostream &s)
const;
199 virtual void listValues(vector<const PatternValue *> &list)
const {
200 left->listValues(list); right->listValues(list); }
201 virtual void getMinMax(vector<intb> &minlist,vector<intb> &maxlist)
const {
202 left->getMinMax(minlist,maxlist); right->getMinMax(minlist,maxlist); }
203 virtual void saveXml(ostream &s)
const;
216 virtual void listValues(vector<const PatternValue *> &list)
const {
217 unary->listValues(list); }
218 virtual void getMinMax(vector<intb> &minlist,vector<intb> &maxlist)
const {
219 unary->getMinMax(minlist,maxlist);
221 virtual void saveXml(ostream &s)
const;
230 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
231 virtual void saveXml(ostream &s)
const;
239 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
240 virtual void saveXml(ostream &s)
const;
248 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
249 virtual void saveXml(ostream &s)
const;
257 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
258 virtual void saveXml(ostream &s)
const;
266 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
267 virtual void saveXml(ostream &s)
const;
275 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
276 virtual void saveXml(ostream &s)
const;
284 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
285 virtual void saveXml(ostream &s)
const;
293 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
294 virtual void saveXml(ostream &s)
const;
302 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
303 virtual void saveXml(ostream &s)
const;
311 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
312 virtual void saveXml(ostream &s)
const;
320 virtual intb getSubValue(
const vector<intb> &replace,int4 &listpos)
const;
321 virtual void saveXml(ostream &s)
const;
325 vector<OperandSymbol *> &operands;
327 base=-1; offset=0; cur_rightmost = -1; size = 0; }
343 const TokenPattern &getTokenPattern(
void)
const {
return resultpattern; }
344 virtual void genPattern(
const vector<TokenPattern> &ops)
const=0;
346 virtual void operandOrder(
Constructor *ct,vector<OperandSymbol *> &order)
const {}
347 void layClaim(
void) { refcount += 1; }
355 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
357 virtual void operandOrder(
Constructor *ct,vector<OperandSymbol *> &order)
const;
366 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
383 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
389 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
395 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
401 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
407 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
413 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
423 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
425 virtual void operandOrder(
Constructor *ct,vector<OperandSymbol *> &order)
const;
435 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
437 virtual void operandOrder(
Constructor *ct,vector<OperandSymbol *> &order)
const;
447 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
449 virtual void operandOrder(
Constructor *ct,vector<OperandSymbol *> &order)
const;
458 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
460 virtual void operandOrder(
Constructor *ct,vector<OperandSymbol *> &order)
const;
469 virtual void genPattern(
const vector<TokenPattern> &ops)
const;
471 virtual void operandOrder(
Constructor *ct,vector<OperandSymbol *> &order)
const;
Definition: slghpatexpress.hh:279
Definition: slghpatexpress.hh:207
Definition: slghpatexpress.hh:386
Definition: slghpatexpress.hh:56
Definition: slghpatexpress.hh:315
Definition: slghpattern.hh:51
Definition: slghpattern.hh:22
static uintb byteToAddress(uintb val, uint4 ws)
Scale from byte units to addressable units.
Definition: space.hh:496
Definition: slghpatexpress.hh:463
Definition: slghpatexpress.hh:234
Definition: slghpatexpress.hh:270
Definition: slghpatexpress.hh:128
Definition: slghpatexpress.hh:78
void zero_extend(intb &val, int4 bit)
Clear all bits above given bit.
Definition: address.cc:639
Definition: slghpatexpress.hh:392
Definition: slghpatexpress.hh:410
Definition: slghpatexpress.hh:21
Definition: slghpatexpress.hh:252
Definition: slghpatexpress.hh:89
Definition: slghpatexpress.hh:155
AddrSpace * getSpace(void) const
Get the address space.
Definition: address.hh:294
The interface to a translation engine for a processor.
Definition: translate.hh:293
Definition: slghpatexpress.hh:360
Definition: slghpatexpress.hh:306
Definition: slghpatexpress.hh:428
An XML element. A node in the DOM tree.
Definition: xml.hh:150
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
Definition: context.hh:124
Definition: slghpatexpress.hh:225
Definition: slghpatexpress.hh:261
Definition: slghpatexpress.hh:452
Definition: slghpatexpress.hh:416
Definition: slghpatexpress.hh:351
Definition: slghpatexpress.hh:380
Definition: slghpatexpress.hh:288
Definition: slghsymbol.hh:313
Definition: slghpatexpress.hh:404
Definition: slghpatexpress.hh:142
uint4 getWordSize(void) const
Get the addressable unit size.
Definition: space.hh:325
Definition: slghpatexpress.hh:324
Definition: slghpatexpress.hh:189
Definition: context.hh:22
Definition: slghpatexpress.hh:108
Definition: slghpatexpress.hh:398
Definition: slghpatexpress.hh:440
Definition: slghpatexpress.hh:370
Definition: slghpatexpress.hh:297
Definition: slghsymbol.hh:466
Definition: slghpatexpress.hh:170
Definition: slghpatexpress.hh:336
Definition: slghpatexpress.hh:243