-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from JakeRoggenbuck/more-codegen
More codegen
- Loading branch information
Showing
5 changed files
with
72 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
// Possibility later | ||
#include <stdint.h> | ||
|
||
#include "codegen.h" | ||
|
||
#include <testing/tassert.h> // tassert | ||
|
||
struct RGenState { | ||
// Each bit corresponds with a registers 0-31 where the LSB is 0 | ||
uint32_t registers_in_use; | ||
|
||
unsigned int sp_offset; | ||
} RGEN_STATE; | ||
|
||
void r_code_gen_init() { | ||
RGEN_STATE.registers_in_use = 0; | ||
RGEN_STATE.sp_offset = 0; | ||
} | ||
|
||
char *r_start_main() { | ||
static char start[256] = "\ | ||
.global _start\n\ | ||
_start:\n"; | ||
|
||
return start; | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// Possibility later | ||
void r_code_gen_init(); | ||
|
||
#pragma once | ||
char *r_start_main(); |
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