forked from parrot/parrot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Vanilla Register allocator. PASM emitter is currently under
development. git-svn-id: https://svn.parrot.org/parrot/trunk@13918 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
- Loading branch information
1 parent
08fd404
commit 144253f
Showing
12 changed files
with
314 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef PARROT_BCG_EMTITTER_H_GUARD | ||
#define PARROT_BCG_EMTITTER_H_GUARD | ||
|
||
#include "bcg.h" | ||
|
||
/* TODO Define standard emitter API that can support multiple emitter*/ | ||
void emit_pasm(BCG_info * info); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "bcg_emitter.h" | ||
#include "bcg_private.h" | ||
#include "bcg.h" | ||
|
||
void | ||
emit_pasm(BCG_info * bcg_info) | ||
{ | ||
bcg_unit *unit; | ||
bcg_info_private *bcg_info_priv; | ||
|
||
bcg_info_priv = BCG_INFO_PRIV(bcg_info); | ||
unit = bcg_info_priv->first_unit; | ||
|
||
while (unit) { | ||
bcg_op *op; | ||
op = unit->first_op; | ||
|
||
printf("_%s:\n", unit->name); | ||
while (op) { | ||
if (op->type == BCG_OP_LABEL) { | ||
printf("%s:\n", op->name); | ||
} | ||
else { | ||
int i; | ||
bcg_op_arg *op_arg; | ||
printf(" %s", op->full_name); | ||
for (i = 0; i < op->op_arg_count; i++) { | ||
op_arg = op->op_args[i]; | ||
if (op_arg->is_constant) { | ||
printf(", \"%s\"", op_arg->name); | ||
} | ||
else { | ||
printf(" %c%d", op_arg->data_type, op_arg->reg_num); | ||
} | ||
} | ||
printf("\n"); | ||
} | ||
|
||
op = op->next; | ||
} | ||
unit = unit->next; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef PARROT_BCG_REG_ALLOC_H_GUARD | ||
#define PARROT_BCG_REG_ALLOC_H_GUARD | ||
|
||
#include "bcg.h" | ||
#include "bcg_private.h" | ||
|
||
/* TODO standardize register allocation API to support different allocators.*/ | ||
void reg_alloc_vanilla(BCG_info * bcg_info, bcg_unit * unit); | ||
|
||
#endif /* PARROT_BCG_REG_ALLOC_H_GUARD */ |
Oops, something went wrong.