Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

A more assembly-like usage of C as a compilation target language?
Is there any advantage in using large amounts of gotos and similar
things to use C only as a cross-platform assembly, compared to using C
constructs like, say, Chicken does?

(One divantage I can think of is that it could make FFIs harder.)

Report this thread to moderator Post Follow-up to this message
Old Post
Sunnan
04-22-05 08:58 AM


Re: A more assembly-like usage of C as a compilation target language?
Sunnan wrote:
> Is there any advantage in using large amounts of gotos and similar
> things to use C only as a cross-platform assembly, compared to using C
> constructs like, say, Chicken does?
>
> (One divantage I can think of is that it could make FFIs harder.)

Yes, you avoid the horrible calling conventions.

OTOH you have to compile everything into one function, which is
probably slow for GCC to process (with all those graph
algorithms).  You lose separate compilation, and you can't call
individual functions from outside the big blob method.

For a while I though about this, but if I need to get real machine
code, I'd rather compile to assembler instead.

--
No man is good enough to govern another man without that other's
consent. -- Abraham Lincoln

Report this thread to moderator Post Follow-up to this message
Old Post
Ulrich Hobelmann
04-22-05 08:58 AM


Re: A more assembly-like usage of C as a compilation target language?
I wonder if you could generate gcc's RTL and somehow convince GCC to
compile that?

Jon
----
Learn to program using Linux assembly language
http://www.cafeshops.com/bartlettpublish.8640017

Report this thread to moderator Post Follow-up to this message
Old Post
Jonathan Bartlett
04-22-05 09:01 PM


Re: A more assembly-like usage of C as a compilation target language?
Jonathan Bartlett wrote:
> I wonder if you could generate gcc's RTL and somehow convince GCC to
> compile that?

It would certainly be great if you could define your own calling
conventions and otherwise use GCC's backend for optimizing,
scheduling and register allocation.  However, there doesn't seem
to be lots of docs available, so I think it's easier
(unfortunately, as with many badly docced open-source projects) to
just roll your own simple backend.  If you don't use C's calling
conventions it might even be *faster* for well-structured code
using many functions (ok, then maybe inlining would be a good
thing to add, too...).

--
No man is good enough to govern another man without that other's
consent. -- Abraham Lincoln

Report this thread to moderator Post Follow-up to this message
Old Post
Ulrich Hobelmann
04-22-05 09:01 PM


Re: A more assembly-like usage of C as a compilation target language?
Marcin 'Qrczak' Kowalczyk wrote:
> Jonathan Bartlett <johnnyb@eskimo.com> writes:
>
> 
>
>
> I guess it would be painful to port to various GCC versions as the RTL
> is evolving.
>

How about a very thin frontend? It should map pretty closely to rtl, but
still be sexp.
I think I read of such a work in progress, once. Wonder what happened
with it.

Report this thread to moderator Post Follow-up to this message
Old Post
Sunnan
04-23-05 01:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Scheme archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:23 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.