25 #include <sys/types.h>
28 #if defined (_MSC_VER)
36 #include <granulation.h>
37 #include <trace_malloc.h>
51 #define SUBDIM_UNUSED (size_t)-1
55 MAX_STATEMENT_PRIORITY = 63,
56 MAX_STATEMENT_LENGTH = 4096
66 FUNC_NAME_MAXLEN = KSTRING_MAXLEN
70 SubproblemDim subdims[MAX_SUBDIMS];
76 struct StatementBatch;
89 typedef enum CLMemFence {
97 typedef enum UptrType {
107 typedef struct Kstring {
109 char buf[KSTRING_MAXLEN];
117 (*LoopUnrollGen)(
struct KgenContext *ctx,
void *priv);
125 typedef struct LoopCtl {
132 unsigned long inBound;
139 typedef struct LoopUnrollers {
141 LoopUnrollGen preUnroll;
143 LoopUnrollGen genSingleVec;
145 LoopUnrollGen genSingle;
147 LoopUnrollGen postUnroll;
149 LoopUnrollGen getVecLen;
155 emptyKstring(Kstring *kstr)
161 isKstringEmpty(
const Kstring *kstr)
163 return (kstr->buf[0] ==
'\0');
190 *createKgenContext(
char *srcBuf,
size_t srcBufLen,
bool fmt);
199 destroyKgenContext(
struct KgenContext *ctx);
211 resetKgenContext(
struct KgenContext *ctx);
234 struct KgenContext *srcCtx,
235 const struct KgenContext *dstCtx,
251 kgenDeclareFunction(
struct KgenContext *ctx,
const char *decl);
264 kgenBeginFuncBody(
struct KgenContext *ctx);
278 kgenEndFuncBody(
struct KgenContext *ctx);
296 const struct KgenContext *ctx);
313 kgenBeginBranch(
struct KgenContext *ctx,
const char *stmt);
330 kgenEndBranch(
struct KgenContext *ctx,
const char *stmt);
348 kgenAddStmt(
struct KgenContext *ctx,
const char *stmt);
351 kgenPrintf(
struct KgenContext *ctx,
const char *fmt,...);
353 struct StatementBatch
354 *createStmtBatch(
void);
358 struct StatementBatch *batch,
364 struct StatementBatch *batch,
366 const char *fmt,...);
369 flushStmtBatch(
struct KgenContext *ctx,
struct StatementBatch *batch);
372 destroyStmtBatch(
struct StatementBatch *batch);
384 kgenAddBlankLine(
struct KgenContext *ctx);
397 kgenSourceSize(
struct KgenContext *ctx);
418 kgenAddBarrier(
struct KgenContext *ctx, CLMemFence fence);
430 kgenAddMemFence(
struct KgenContext *ctx, CLMemFence fence);
447 struct KgenContext *ctx,
449 const PGranularity *pgran);
466 struct KgenContext *ctx,
468 const PGranularity *pgran);
480 kgenDeclareUptrs(
struct KgenContext *ctx,
bool withDouble);
519 struct KgenContext *ctx,
522 const LoopUnrollers *unrollers,
542 struct KgenContext *ctx,
543 int (*genCallback)(
struct KgenContext *ctx,
const void *pattern),
558 struct KgenGuard *guard,
559 struct KgenContext *ctx,
560 int (*genCallback)(
struct KgenContext *ctx,
const void *pattern),
584 findGenerateFunction(
585 struct KgenGuard *guard,
597 destroyKgenGuard(
struct KgenGuard *guard);
609 kstrcpy(Kstring *kstr,
const char *str);
612 ksprintf(Kstring *kstr,
const char *fmt,...);
615 kstrcatf(Kstring *kstr,
const char *fmt,...);
619 *uptrTypeName(UptrType type);
634 dtypeToPrefix(DataType type);
645 *dtypeBuiltinType(DataType dtype);
656 *dtypeUPtrField(DataType dtype);
667 *strOne(DataType dtype);
686 const char **typeName,
687 const char **typePtrName);