5 #include "xi-SdagConstruct.h"
6 #include "xi-Template.h"
15 // class SdagConstruct;
17 class WhenStatementEChecker
;
19 /******************* Entry Point ****************/
21 #define STHREADED 0x01
25 #define SMIGRATE 0x20 //<- is magic migration constructor
26 #define SCREATEHERE 0x40 //<- is a create-here-if-nonexistant
27 #define SCREATEHOME 0x80 //<- is a create-at-home-if-nonexistant
28 #define SIMMEDIATE 0x100 //<- is a immediate
30 #define SNOTRACE 0x400
31 #define SSKIPSCHED 0x800 //<- is a message skipping charm scheduler
32 #define SPYTHON 0x1000
33 #define SINLINE 0x2000 //<- inline message
35 #define SLOCAL 0x8000 //<- local message
36 #define SACCEL 0x10000
38 #define SREDUCE 0x40000 // <- reduction target
39 #define SAPPWORK 0x80000 // <- reduction target
40 #define SAGGREGATE 0x100000
42 /* An entry construct */
43 class Entry
: public Member
{
45 XStr
* genClosureTypeName
;
46 XStr
* genClosureTypeNameProxy
;
47 XStr
* genClosureTypeNameProxyTemp
;
49 int first_line_
, last_line_
;
55 const char *pythonDoc
;
63 // friend class CParsedFile;
65 void genCall(XStr
&dest
,const XStr
&preCall
, bool redn_wrapper
=false,
66 bool usesImplBuf
= false);
68 XStr
epStr(bool isForRedn
= false, bool templateCall
= false);
69 XStr
epIdx(int fromProxy
=1, bool isForRedn
= false);
70 XStr
epRegFn(int fromProxy
=1, bool isForRedn
= false);
71 XStr
chareIdx(int fromProxy
=1);
72 void genEpIdxDecl(XStr
& str
);
73 void genEpIdxDef(XStr
& str
);
75 void genClosure(XStr
& str
, bool isDef
);
76 void genClosureEntryDefs(XStr
& str
);
77 void genClosureEntryDecls(XStr
& str
);
79 void genChareDecl(XStr
& str
);
80 void genChareStaticConstructorDecl(XStr
& str
);
81 void genChareStaticConstructorDefs(XStr
& str
);
82 void genChareDefs(XStr
& str
);
84 void genArrayDefs(XStr
& str
);
85 void genArrayStaticConstructorDecl(XStr
& str
);
86 void genArrayStaticConstructorDefs(XStr
& str
);
87 void genArrayDecl(XStr
& str
);
89 void genGroupDecl(XStr
& str
);
90 void genGroupStaticConstructorDecl(XStr
& str
);
91 void genGroupStaticConstructorDefs(XStr
& str
);
92 void genGroupDefs(XStr
& str
);
94 void genPythonDecls(XStr
& str
);
95 void genPythonDefs(XStr
& str
);
96 void genPythonStaticDefs(XStr
& str
);
97 void genPythonStaticDocs(XStr
& str
);
100 void genTramDefs(XStr
&str
);
101 void genTramInstantiation(XStr
&str
);
103 // DMK - Accel Support
104 void genAccelFullParamList(XStr
& str
, int makeRefs
);
105 void genAccelFullCallList(XStr
& str
);
106 void genAccelIndexWrapperDecl_general(XStr
& str
);
107 void genAccelIndexWrapperDef_general(XStr
& str
);
108 void genAccelIndexWrapperDecl_spe(XStr
& str
);
109 void genAccelIndexWrapperDef_spe(XStr
& str
);
110 int genAccels_spe_c_funcBodies(XStr
& str
);
111 void genAccels_spe_c_regFuncs(XStr
& str
);
112 void genAccels_ppe_c_regFuncs(XStr
& str
);
114 XStr
aggregatorIndexType();
117 XStr
aggregatorType();
118 XStr
aggregatorGlobalType(XStr
& scope
);
119 XStr
aggregatorName();
120 XStr
paramType(int withDefaultVals
,int withEO
=0,int useConst
=1);
121 XStr
paramComma(int withDefaultVals
,int withEO
=0);
122 XStr
eo(int withDefaultVals
,int priorComma
=1);
123 XStr
syncPreCall(void);
124 XStr
syncPostCall(void);
125 XStr
marshallMsg(void);
126 XStr
callThread(const XStr
&procName
,int prependEntryName
=0);
129 std::list
<CStateVar
*> estateVars
;
137 SdagConstruct
*sdagCon
;
138 std::list
<CStateVar
*> stateVars
;
144 void addEStateVar(CStateVar
*sv
) {
145 estateVars
.push_back(sv
);
146 stateVars
.push_back(sv
);
149 int tramInstanceIndex
;
151 // DMK - Accel Support
152 ParamList
* accelParam
;
154 XStr
* accelCallbackName
;
155 void setAccelParam(ParamList
* apl
);
156 void setAccelCodeBody(XStr
* acb
);
157 void setAccelCallbackName(XStr
* acbn
);
159 // DMK - Accel Support
160 int accel_numScalars
;
162 int accel_dmaList_numReadOnly
;
163 int accel_dmaList_numReadWrite
;
164 int accel_dmaList_numWriteOnly
;
165 int accel_dmaList_scalarNeedsWrite
;
167 Entry(int l
, int a
, Type
*r
, const char *n
, ParamList
*p
, Value
*sz
=0, SdagConstruct
*sc
=0, const char *e
=0, int fl
=-1, int ll
=-1);
168 void setChare(Chare
*c
);
169 int paramIsMarshalled(void);
170 int getStackSize(void);
171 int isThreaded(void);
174 int isConstructor(void);
175 bool isMigrationConstructor();
176 int isExclusive(void);
177 int isImmediate(void);
178 int isSkipscheduler(void);
182 int isCreateHome(void);
183 int isCreateHere(void);
189 int isTramTarget(void);
191 // DMK - Accel support
194 int isMemCritical(void);
195 int isReductionTarget(void);
197 void print(XStr
& str
);
199 void genIndexDecls(XStr
& str
);
200 void genDecls(XStr
& str
);
201 void genDefs(XStr
& str
);
202 void genReg(XStr
& str
);
203 XStr
genRegEp(bool isForRedn
= false);
205 void preprocessSDAG();
206 char *getEntryName();
207 void generateEntryList(std::list
<CEntry
*>&, WhenConstruct
*);
208 void collectSdagCode(SdagCollection
*sc
);
209 void propagateState(int);
210 void lookforCEntry(CEntry
*centry
);
212 void genTramRegs(XStr
& str
);
213 void genTramPups(XStr
& scope
, XStr
& decls
, XStr
& defs
);
216 // TODO(Ralf): why not simply use list<Entry*> instead?
221 EntryList(Entry
*e
,EntryList
*elist
=NULL
):
222 entry(e
), next(elist
) {}
223 void generateEntryList(std::list
<CEntry
*>&, WhenConstruct
*);
228 #endif // ifndef _ENTRY_H