Add -v3 option for call graph data, change some function in neslib to inline

This commit is contained in:
drmortalwombat 2023-03-10 17:08:22 +01:00
parent 5bd4f4e9a5
commit 868564ff08
7 changed files with 33 additions and 25 deletions

View File

@ -18,30 +18,30 @@ const char palBrightTable[] = {
0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30
};
char OAM_BUF[256];
char PAL_BUF[32];
volatile char OAM_BUF[256];
volatile char PAL_BUF[32];
#pragma align(OAM_BUF, 256)
char NTSC_MODE;
volatile char FRAME_CNT1;
volatile char FRAME_CNT2;
char VRAM_UPDATE;
char * NAME_UPD_ADR;
char NAME_UPD_ENABLE;
char PAL_UPDATE;
const char * PAL_BG_PTR;
const char * PAL_SPR_PTR;
char SCROLL_X;
char SCROLL_Y;
volatile char VRAM_UPDATE;
char * volatile NAME_UPD_ADR;
volatile char NAME_UPD_ENABLE;
volatile char PAL_UPDATE;
const char *volatile PAL_BG_PTR;
const char *volatile PAL_SPR_PTR;
volatile char SCROLL_X;
volatile char SCROLL_Y;
char SCROLL_X1;
char SCROLL_Y1;
char PAD_STATE[2];
char PAD_STATEP[2];
char PAD_STATET[2];
char PPU_CTRL_VAR;
volatile char PPU_CTRL_VAR;
char PPU_CTRL_VAR1;
char PPU_MASK_VAR;
volatile char PPU_MASK_VAR;
char RAND_SEED[2];
int main(void)

View File

@ -48,7 +48,7 @@ void pal_bg(const char *data);
void pal_spr(const char *data);
// set a palette entry, index is 0..31
void pal_col(unsigned char index, unsigned char color);
inline void pal_col(unsigned char index, unsigned char color);
// reset palette to $0f
void pal_clear(void);
@ -83,7 +83,7 @@ void ppu_on_bg(void);
void ppu_on_spr(void);
// set PPU_MASK directly
void ppu_mask(unsigned char mask);
inline void ppu_mask(unsigned char mask);
// get current video system, 0 for PAL, not 0 for NTSC
unsigned char ppu_system(void);
@ -92,19 +92,19 @@ unsigned char ppu_system(void);
unsigned char nesclock(void);
// get/set the internal ppu ctrl cache var for manual writing
unsigned char get_ppu_ctrl_var(void);
void set_ppu_ctrl_var(unsigned char var);
inline unsigned char get_ppu_ctrl_var(void);
inline void set_ppu_ctrl_var(unsigned char var);
// clear OAM buffer, all the sprites are hidden
void oam_clear(void);
// set sprite display mode, 0 for 8x8 sprites, 1 for 8x16 sprites
void oam_size(unsigned char size);
inline void oam_size(unsigned char size);
// set sprite in OAM buffer, chrnum is tile, attr is attribute, sprid is offset in OAM in bytes
// returns sprid+4, which is offset for a next sprite
unsigned char oam_spr(unsigned char x, unsigned char y,
inline unsigned char oam_spr(unsigned char x, unsigned char y,
unsigned char chrnum, unsigned char attr,
unsigned char sprid);
@ -147,7 +147,7 @@ unsigned char pad_poll(unsigned char pad);
unsigned char pad_trigger(unsigned char pad);
// get previous pad state without polling ports
unsigned char pad_state(unsigned char pad);
inline unsigned char pad_state(unsigned char pad);
// set scroll, including rhe top bits
@ -195,7 +195,7 @@ void set_rand(unsigned int seed);
// length of this data should be under 256 bytes
void set_vram_update(unsigned char *buf);
inline void set_vram_update(unsigned char *buf);
// all following vram functions only work when display is disabled
@ -203,16 +203,16 @@ void set_vram_update(unsigned char *buf);
void flush_vram_update(unsigned char *buf);
// set vram pointer to write operations if you need to write some data to vram
void vram_adr(unsigned int adr);
inline void vram_adr(unsigned int adr);
// put a byte at current vram address, works only when rendering is turned off
void vram_put(unsigned char n);
inline void vram_put(unsigned char n);
// fill a block with a byte at current vram address, works only when rendering is turned off
void vram_fill(unsigned char n, unsigned int len);
// set vram autoincrement, 0 for +1 and not 0 for +32
void vram_inc(unsigned char n);
inline void vram_inc(unsigned char n);
// read a block from current address of vram, works only when rendering is turned off
void vram_read(unsigned char *dst, unsigned int size);

View File

@ -516,7 +516,8 @@ bool Compiler::GenerateCode(void)
mGlobalAnalyzer->CheckInterrupt();
mGlobalAnalyzer->AutoInline();
//mGlobalAnalyzer->DumpCallGraph();
if (mCompilerOptions & COPT_VERBOSE3)
mGlobalAnalyzer->DumpCallGraph();
mInterCodeGenerator->mCompilerOptions = mCompilerOptions;
mNativeCodeGenerator->mCompilerOptions = mCompilerOptions;

View File

@ -25,6 +25,7 @@ static const uint64 COPT_TARGET_NES = 0x4000000000ULL;
static const uint64 COPT_VERBOSE = 0x10000000000ULL;
static const uint64 COPT_VERBOSE2 = 0x20000000000ULL;
static const uint64 COPT_VERBOSE3 = 0x40000000000ULL;
static const uint64 COPT_NATIVE = 0x01000000;

View File

@ -80,6 +80,7 @@ static const uint64 DTF_FUNC_VARIABLE = (1ULL << 32);
static const uint64 DTF_FUNC_ASSEMBLER = (1ULL << 33);
static const uint64 DTF_FUNC_RECURSIVE = (1ULL << 34);
static const uint64 DTF_FUNC_ANALYZING = (1ULL << 35);
static const uint64 DTF_FUNC_CONSTEXPR = (1ULL << 36);
static const uint64 DTF_FUNC_INTRSAVE = (1ULL << 37);
static const uint64 DTF_FUNC_INTRCALLED = (1ULL << 38);

View File

@ -971,7 +971,10 @@ bool Linker::WriteMlbFile(const char* filename)
for(int i=0; i<obj->mRanges.Size(); i++)
fprintf(file, "R:%04x-%04x:%s@%s\n", obj->mAddress + obj->mRanges[i].mOffset, obj->mAddress + obj->mRanges[i].mOffset + obj->mRanges[i].mSize - 1, obj->mIdent->mString, obj->mRanges[i].mIdent->mString);
}
fprintf(file, "R:%04x-%04x:%s\n", obj->mAddress, obj->mAddress + obj->mSize - 1, obj->mIdent->mString);
if (obj->mSize > 1)
fprintf(file, "R:%04x-%04x:%s\n", obj->mAddress, obj->mAddress + obj->mSize - 1, obj->mIdent->mString);
else
fprintf(file, "R:%04x:%s\n", obj->mAddress, obj->mIdent->mString);
}
else if (obj->mType == LOT_DATA)
{

View File

@ -216,6 +216,8 @@ int main2(int argc, const char** argv)
compiler->mCompilerOptions |= COPT_VERBOSE;
if (arg[2] == '2')
compiler->mCompilerOptions |= COPT_VERBOSE2;
else if (arg[2] == '3')
compiler->mCompilerOptions |= COPT_VERBOSE2 | COPT_VERBOSE3;
}
else if (arg[1] == 'x' && arg[2] == 'z')
{