flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > idea of assembly language with register allocation & stu

Author
Thread Post new topic Reply to topic
skingston



Joined: 11 Dec 2004
Posts: 19
skingston 31 Dec 2006, 05:33
Hi,

I've been thinking about developing a pre-assembler, or compiler that products fasm code.

I've thought of a few features that I think would be useful for developing programs in an (almost) assembly language, but I'm not sure whether it is worth doing it.

The main feature is register allocation. My idea is to allow programs to be written with an unlimited amount of registers (ie. not needing to worry about which registers are being used by sections of code and therefore not having to save/restore or re-write code when the use of registers change). The compiler would determine when a register needs to be saved/restored to/from the stack or global variables.

For example, say you write a macro that prints out a string using certain registers and you use that macro everywhere in your code. If you then change the macro to display the message in another way, which requires the use of more registers, you would either need to push/pop the extra registers in the macro, or go through all of your code to make sure those registers are available where the macro is used.

With my idea, you can easily split procedural-based code up into smaller sections of code, or macros and edit them without effecting the rest of the code, while still making the code quite efficient.

I was also planning to add extra features to this so that you can create libraries, or partially-built code based on these 'macros' so that you could efficiently reuse code that you or someone else has previously written.
For example, you could use a 'macro' called 'myLibraryFile.printMessage', or something similar throughout your program and the compiler would extract the code from the macro and allocate all of the registers before it is assembled.

I'm not sure if what I've written will make much sense to you, but does anyone have any thoughts on this? Is it a good idea, or is it a waste of time & perhaps I should just use a higher level language instead?
Post 31 Dec 2006, 05:33
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 31 Dec 2006, 09:22
what is wrong about C?
Post 31 Dec 2006, 09:22
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
skingston



Joined: 11 Dec 2004
Posts: 19
skingston 07 Jan 2007, 05:09
There is nothing wrong with C, other then a lot pushing/poping and calling/returning (like most languages) which isn't really required
Post 07 Jan 2007, 05:09
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.