Skip to content

Commit

Permalink
compiler: give access to patch_compile but without prologue and epilo…
Browse files Browse the repository at this point in the history
…gues
  • Loading branch information
wpwrak committed Feb 26, 2012
1 parent 8c38036 commit ab02b37
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/compiler/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static void pvv_bind_callback(void *_sc, struct fpvm_sym *sym, int reg)
r->regs->pvv = sc->p->pervertex_regs+reg;
}

static bool init_pvv(struct compiler_sc *sc)
static bool init_pvv(struct compiler_sc *sc, int framework)
{
int i;

Expand All @@ -294,7 +294,7 @@ static bool init_pvv(struct compiler_sc *sc)
fpvm_set_bind_callback(&sc->pvv_fragment, pvv_bind_callback, sc);

fpvm_set_bind_mode(&sc->pvv_fragment, FPVM_BIND_SOURCE);
if(!compile_chunk(&sc->pvv_fragment, INIT_PVV_FNP))
if(framework && !compile_chunk(&sc->pvv_fragment, INIT_PVV_FNP))
goto fail_assign;
fpvm_set_bind_mode(&sc->pvv_fragment, FPVM_BIND_ALL);

Expand Down Expand Up @@ -474,8 +474,8 @@ static bool parse_patch(struct compiler_sc *sc, const char *patch_code)
return ok;
}

struct patch *patch_compile(const char *basedir, const char *patch_code,
report_message rmc)
struct patch *patch_do_compile(const char *basedir, const char *patch_code,
report_message rmc, int framework)
{
struct compiler_sc *sc;
struct patch *p;
Expand Down Expand Up @@ -507,14 +507,14 @@ struct patch *patch_compile(const char *basedir, const char *patch_code,

load_defaults(sc);
if(!init_pfv(sc)) goto fail;
if(!init_pvv(sc)) goto fail;
if(!init_pvv(sc, framework)) goto fail;

if(!parse_patch(sc, patch_code))
goto fail;

if(!finalize_pfv(sc)) goto fail;
if(framework && !finalize_pfv(sc)) goto fail;
if(!schedule_pfv(sc)) goto fail;
if(!finalize_pvv(sc)) goto fail;
if(framework && !finalize_pvv(sc)) goto fail;
if(!schedule_pvv(sc)) goto fail;

#ifndef STANDALONE
Expand All @@ -532,6 +532,12 @@ struct patch *patch_compile(const char *basedir, const char *patch_code,
return NULL;
}

struct patch *patch_compile(const char *basedir, const char *patch_code,
report_message rmc)
{
return patch_do_compile(basedir, patch_code, rmc, 1);
}

struct patch *patch_compile_filename(const char *filename,
const char *patch_code, report_message rmc)
{
Expand Down
9 changes: 9 additions & 0 deletions src/compiler/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,17 @@ typedef void (*report_message)(const char *);
struct compiler_sc;

void init_fpvm(struct fpvm_fragment *fragment, int vector_mode);

/*
* Flickernoise only uses patch_compile. patch_do_compile allows disabling
* the patch framework, which is useful for code analysis in ptest.
*/

struct patch *patch_do_compile(const char *basedir, const char *patch_code,
report_message rmc, int framework);
struct patch *patch_compile(const char *basedir, const char *patch_code,
report_message rmc);

struct patch *patch_compile_filename(const char *filename,
const char *patch_code, report_message rmc);
struct stimuli *compiler_get_stimulus(struct compiler_sc *sc);
Expand Down

0 comments on commit ab02b37

Please sign in to comment.