🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41913

Re: using gcc to optimize assembly code?

#41913
From: Maurizio Vitale
Date: Tue, 13 Feb 1996 00:00
52 lines
2429 bytes
In article <4fkpos$4nu@fsuj01.rz.uni-jena.de> mwj@rz.uni-jena.de (Johannes Waldmann) writes:

> From: mwj@rz.uni-jena.de (Johannes Waldmann)
> Newsgroups: gnu.gcc.help
> Date: 11 Feb 1996 13:08:44 GMT
> Organization: Friedrich-Schiller-University Jena, Germany
> 
> Perhaps this is a bit naive, but here goes:
> 
> 	Can I use gcc's back-end to optimize assembler programs?
> 
> Possibly, assembler code could be transformed into RTL,
> then gcc could read that, and proceed as if it came from
> the expansion of a syntax tree.

No. The RTL chain contains only a portion of the compilation state.

> Are gcc's machine descriptions `invertible', i. e. can they be
> used to automatically generate .rtl from .s?

Again, no: machine descriptions map the RTL gcc generates for that 
particular target into assembly language, but the assembler of
a given target is usually not covered completely.

> Can I make the gcc back-end _start_ at a certain stage 
> of the compilation?  Something like:
> 	gcc -dr foo.c;  gcc --start-with-r foo.c.rtl

In theory. As long as you reproduce the state of all GCC's data structures 
necessary from that point on.

> By the way, is such a foo.c.rtl fully self-contained?

Not a chanche, RTL dumps are intended for debugging the compiler and
machine descriptions, not for re-entering GCC.

> Has someone already done such things? How much work would it require?

A fair amount.

> Would it be worth it?

For optimizing assembler, I would say no. For other applications, maybe.

-- 
				Maurizio Vitale
 _______________
|        _      |\   e-mail: mav@cc.gatech.edu        | How many times can
|  /|/| '_) | ) | |  voice:  (404) 303-1421 (home)    | a man turn his head,
| | | |_(_|_|/  | |          (404) 894-5613 (work)    | and pretend that he
|_______________| |  fax:    (404) 894-9846           | just doesn't see ?
 \_______________\|  PGP key:finger mav@cc.gatech.edu |  - Bob Dylan
Technical Details
Message-ID: <m6ju40vjh2g.fsf@gaia.cc.gatech.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4fkpos$4nu@fsuj01.rz.uni-jena.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,e3ec584f3f4b0cbe
X-Google-Attributes: gid11318c,public
From: mav@gaia.cc.gatech.edu (Maurizio Vitale)
Subject: Re: using gcc to optimize assembly code?
Date: 1996/02/13
Message-ID: <m6ju40vjh2g.fsf@gaia.cc.gatech.edu>
X-Deja-AN: 139242485
references: <4fkpos$4nu@fsuj01.rz.uni-jena.de>
organization: Georgia Institute of Technology
nntp-posting-user: mav
newsgroups: gnu.gcc.help