Please log in.
Before you can vote, you need to register. Please log in or create an account.
Computer: Programming
Machine-Optimizable Assembler   (+3)  [vote for, against]
Substitute descriptive names for register names

By using macros to substitute descriptive names for register names, an assembler could determine when each named value was needed and when it could be discarded to allow another named value to be stored there.

This would allow assemblers to optimize register allocations, and perhaps other aspects of the code. The programmer would use the macros to tell the assembler his preferred registers for each value, with the expectation that the assembler might have a better choice after its analysis of the code. He would also have an easier time of keeping track of the values he's working with. Something like this:

NormalBakingTime TEXTEQU <40>
BakingTime TEXTEQU <ecx>

mov BakingTime, NormalBakingTime ; Load normal baking time
shr BakingTime, 1 ; Divide baking time in half


Edit: Fixed sample code.
-- Alvin, Sep 05 2016

Baked. The assembler for the DEC LSI-11 bitslice CPU can do this.

Probably not WKTE any more though, as the number of programmers who remember LSI-11s diminishes year by year ...
-- 8th of 7, Sep 05 2016


Old programmers never forget - they just decompile ...
-- 8th of 7, Sep 05 2016



random, halfbakery