You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Memblers of the NESdev forums pointed out the existence of an ASM trick called the "identity table": https://www.nesdev.org/wiki/Identity_table - this uses an identity table (where LDA table,x == x for any given x) to allow using any opcode with an abs,x or abs,y addressing mode as a direct x or y addressing mode.
This is particularly interesting as some of the NES targets already feature what is essentially a (limited) identity table, for handling bus conflicts.
The way I would see this done is:
Implement a compiler switch for enabling use of the identity table.
We certainly don't want this on by default, due to its compiler runtime requirements and 256-byte fixed cost.
However, given some NES mappers require handling bus conflicts, this optimization may be effectively free on those platforms.
Implement the necessary lowering, using an __identity_table table to synthesize, for example, ORA x to ORA __identity_table,x.
Measure if this actually provides meaningful code generation gains.
In llvm-mos-sdk, patch the rompoke logic for handling bus conflicts:
Use the __identity_table symbol name and set it to maximum size (256 bytes), if the identity table is used by the compiler. This may be a little tricky to model.
Make an effort to place __identity_table at the beginning of the fixed bank - this will ensure it's page-aligned, and thus avoid hurting performance.
This is a rough sketch - there's obviously details to be figured out.
The text was updated successfully, but these errors were encountered:
Memblers of the NESdev forums pointed out the existence of an ASM trick called the "identity table": https://www.nesdev.org/wiki/Identity_table - this uses an identity table (where
LDA table,x
==x
for any givenx
) to allow using any opcode with anabs,x
orabs,y
addressing mode as a directx
ory
addressing mode.This is particularly interesting as some of the NES targets already feature what is essentially a (limited) identity table, for handling bus conflicts.
The way I would see this done is:
__identity_table
table to synthesize, for example,ORA x
toORA __identity_table,x
.rompoke
logic for handling bus conflicts:__identity_table
symbol name and set it to maximum size (256 bytes), if the identity table is used by the compiler. This may be a little tricky to model.__identity_table
at the beginning of the fixed bank - this will ensure it's page-aligned, and thus avoid hurting performance.This is a rough sketch - there's obviously details to be figured out.
The text was updated successfully, but these errors were encountered: