16 #ifndef __PCODE_COMPILE__
17 #define __PCODE_COMPILE__
19 #include "slghsymbol.hh"
26 Location(
const string &fname,
const int4 line) { filename = fname; lineno = line; }
27 string getFilename(
void)
const {
return filename; }
28 int4 getLineno(
void)
const {
return lineno; }
29 string format(
void)
const;
50 const ConstTpl &getSize(
void)
const {
return outvn->getSize(); }
51 static vector<OpTpl *> *appendParams(
OpTpl *op,vector<ExprTree *> *param);
52 static vector<OpTpl *> *toVector(
ExprTree *expr);
59 uint4 local_labelcount;
61 virtual uintb allocateTemp(
void)=0;
65 uniqspace=(
AddrSpace *)0; local_labelcount=0; enforceLocalKey=
false; }
68 virtual void reportError(
const Location *loc,
const string &msg)=0;
69 virtual void reportWarning(
const Location *loc,
const string &msg)=0;
70 void resetLabelCount(
void) { local_labelcount=0; }
71 void setDefaultSpace(
AddrSpace *spc) { defaultspace = spc; }
72 void setConstantSpace(
AddrSpace *spc) { constantspace = spc; }
73 void setUniqueSpace(
AddrSpace *spc) { uniqspace = spc; }
74 void setEnforceLocalKey(
bool val) { enforceLocalKey = val; }
75 AddrSpace *getDefaultSpace(
void)
const {
return defaultspace; }
76 AddrSpace *getConstantSpace(
void)
const {
return constantspace; }
80 vector<OpTpl *> *newOutput(
bool usesLocalKey,
ExprTree *rhs,
string *varname,uint4 size=0);
81 void newLocalDefinition(
string *varname,uint4 size=0);
88 vector<OpTpl *> *createOpConst(
OpCode opc,uintb val);
92 vector<OpTpl *> *createUserOpNoOut(
UserOpSymbol *sym,vector<ExprTree *> *param);
94 void appendOp(
OpCode opc,
ExprTree *res,uintb constval,int4 constsz);
96 vector<OpTpl *> *assignBitRange(
VarnodeTpl *vn,uint4 bitoffset,uint4 numbits,
ExprTree *rhs);
99 static void force_size(
VarnodeTpl *vt,
const ConstTpl &size,
const vector<OpTpl *> &ops);
100 static void matchSize(int4 j,
OpTpl *op,
bool inputonly,
const vector<OpTpl *> &ops);
101 static void fillinZero(
OpTpl *op,
const vector<OpTpl *> &ops);