aboutsummaryrefslogtreecommitdiff
path: root/asm/parser.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-02 23:29:43 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-02 23:29:43 +0000
commit6dfc4ceaeb4090edc199ec894aab4cf6233ce130 (patch)
tree607b8fa0adc12b7b82ff8a3791060ca0a53a7088 /asm/parser.c
parent6c4469958e9373773eb7c43d98ff5e20b062c153 (diff)
downloadovm-6dfc4ceaeb4090edc199ec894aab4cf6233ce130.tar.gz
ovm-6dfc4ceaeb4090edc199ec894aab4cf6233ce130.tar.bz2
ovm-6dfc4ceaeb4090edc199ec894aab4cf6233ce130.zip
Better logs for assembler
Diffstat (limited to 'asm/parser.c')
-rw-r--r--asm/parser.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/asm/parser.c b/asm/parser.c
index cf2e53e..4843429 100644
--- a/asm/parser.c
+++ b/asm/parser.c
@@ -458,6 +458,34 @@ struct LabelPair
perr_t process_presults(presult_t *results, size_t res_count,
inst_t **instructions, size_t *inst_count)
{
+#if VERBOSE >= 2
+ printf("[%sprocess_presults%s]: Results found\n", TERM_YELLOW, TERM_RESET);
+ for (size_t i = 0; i < res_count; ++i)
+ {
+ presult_t pres = results[i];
+ switch (pres.type)
+ {
+ case PRES_LABEL:
+ printf("\tLABEL: label=%s\n", pres.label);
+ break;
+ case PRES_LABEL_ADDRESS:
+ printf("\tLABEL_CALL: label=%s, inst=", pres.label);
+ inst_print(pres.instruction, stdout);
+ printf("\n");
+ break;
+ case PRES_RELATIVE_ADDRESS:
+ printf("\tRELATIVE_CALL: addr=%lu, inst=", pres.relative_address);
+ inst_print(pres.instruction, stdout);
+ printf("\n");
+ break;
+ case PRES_COMPLETE_RESULT:
+ printf("\tCOMPLETE: inst=");
+ inst_print(pres.instruction, stdout);
+ printf("\n");
+ break;
+ }
+ }
+#endif
darr_t label_pairs = {0};
darr_init(&label_pairs, sizeof(struct LabelPair));
*inst_count = 0;