28 Token(
const string &nm,int4 sz,
bool be,int4 ind) : name(nm) { size = sz; bigendian=be; index = ind; }
29 int4 getSize(
void)
const {
return size; }
30 bool isBigEndian(
void)
const {
return bigendian; }
31 int4 getIndex(
void)
const {
return index; }
32 const string &getName(
void)
const {
return name; }
49 vector<ConstructState *> resolve;
84 vector<ContextSet> contextcommit;
88 vector<ConstructState> state;
94 ~
ParserContext(
void) {
if (context != (uintm *)0)
delete [] context; }
95 uint1 *getBuffer(
void) {
return buf; }
96 void initialize(int4 maxstate,int4 maxparam,
AddrSpace *spc);
97 int4 getParserState(
void)
const {
return parsestate; }
98 void setParserState(int4 st) { parsestate = st; }
101 void setAddr(
const Address &ad) { addr = ad; }
102 void setNaddr(
const Address &ad) { naddr = ad; }
103 void setCalladdr(
const Address &ad) { calladdr = ad; }
105 void clearCommits(
void) { contextcommit.clear(); }
106 void applyCommits(
void);
107 const Address &getAddr(
void)
const {
return addr; }
108 const Address &getNaddr(
void)
const {
return naddr; }
109 const Address &getDestAddr(
void)
const {
return calladdr; }
110 const Address &getRefAddr(
void)
const {
return calladdr; }
112 AddrSpace *getConstSpace(
void)
const {
return const_space; }
113 uintm getInstructionBytes(int4 byteoff,int4 numbytes,uint4 off)
const;
114 uintm getContextBytes(int4 byteoff,int4 numbytes)
const;
115 uintm getInstructionBits(int4 startbit,int4 size,uint4 off)
const;
116 uintm getContextBits(int4 startbit,int4 size)
const;
117 void setContextWord(int4 i,uintm val,uintm mask) { context[i] = (context[i]&(~mask))|(mask&val); }
118 void loadContext(
void) { contcache->
getContext(addr,context); }
119 int4 getLength(
void)
const {
return base_state->length; }
120 void setDelaySlot(int4 val) { delayslot = val; }
121 int4 getDelaySlot(
void)
const {
return delayslot; }
134 const ParserContext *getParserContext(
void)
const {
return const_context; }
135 void baseState(
void) { point = const_context->base_state; depth=0; breadcrumb[0] = 0; }
137 bool isState(
void)
const {
return (point != (
ConstructState *)0); }
138 void pushOperand(int4 i) { breadcrumb[depth++] = i+1; point = point->resolve[i]; breadcrumb[depth] = 0; }
139 void popOperand(
void) { point = point->parent; depth-= 1; }
140 uint4 getOffset(int4 i)
const {
if (i<0)
return point->offset;
141 ConstructState *op=point->resolve[i];
return op->offset + op->length; }
142 Constructor *getConstructor(
void)
const {
return point->ct; }
143 int4 getOperand(
void)
const {
return breadcrumb[depth]; }
144 FixedHandle &getParentHandle(
void) {
return point->hand; }
145 const FixedHandle &getFixedHandle(int4 i)
const {
return point->resolve[i]->hand; }
146 AddrSpace *getCurSpace(
void)
const {
return const_context->getCurSpace(); }
147 AddrSpace *getConstSpace(
void)
const {
return const_context->getConstSpace(); }
148 const Address &getAddr(
void)
const {
if (cross_context != (
const ParserContext *)0) {
return cross_context->getAddr(); }
return const_context->getAddr(); }
149 const Address &getNaddr(
void)
const {
if (cross_context != (
const ParserContext *)0) {
return cross_context->getNaddr();}
return const_context->getNaddr(); }
150 const Address &getRefAddr(
void)
const {
if (cross_context != (
const ParserContext *)0) {
return cross_context->getRefAddr();}
return const_context->getRefAddr(); }
151 const Address &getDestAddr(
void)
const {
if (cross_context != (
const ParserContext *)0) {
return cross_context->getDestAddr();}
return const_context->getDestAddr(); }
152 int4 getLength(
void)
const {
return const_context->getLength(); }
153 uintm getInstructionBytes(int4 byteoff,int4 numbytes)
const {
154 return const_context->getInstructionBytes(byteoff,numbytes,point->offset); }
155 uintm getContextBytes(int4 byteoff,int4 numbytes)
const {
156 return const_context->getContextBytes(byteoff,numbytes); }
157 uintm getInstructionBits(int4 startbit,int4 size)
const {
158 return const_context->getInstructionBits(startbit,size,point->offset); }
159 uintm getContextBits(int4 startbit,int4 size)
const {
160 return const_context->getContextBits(startbit,size); }
170 void setOffset(uint4 off) { point->offset = off; }
171 void setConstructor(
Constructor *c) { point->ct = c; }
172 void setCurrentLength(int4 len) { point->length = len; }
173 void calcCurrentLength(int4 length,int4 numopers);
188 opstate->parent = walker.point;
190 walker.point->resolve[i] = opstate;
191 walker.breadcrumb[walker.depth++] += 1;
192 walker.point = opstate;
193 walker.breadcrumb[walker.depth] = 0;