This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: mixing optimized and unoptimized code?
- To: maratb at CS dot Berkeley dot EDU
- Subject: Re: mixing optimized and unoptimized code?
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Mon, 6 Mar 2000 00:40:39 +0100
- CC: gcc at gcc dot gnu dot org
- References: <tfvya7xow7p.fsf@cypress.CS.Berkeley.EDU>
> In my application I have several source files for which latest gcc is
> unable to produce optimized code (runs out of memory on a 256M Ultra10
> with -O1). So, I was wondering what would be the implications of
> compiling those few sources unoptimized and linking with the rest of the
> application which is optimized? Are there any optimizations I should
> avoid? (I am thinking of those that change function call conventions)?
You can mix code of all optimization levels as you please; it should
work in all possible combinations. I'm not aware of optimizations that
change function call conventions.
> A related question: which optimizations are not especially memory
> hungry? I was thinking I could selectively turn on *some* of them
> on those problematic sources.
If you are talking about memory consumption in the generated code,
using '-Os' should give you what you want. If you are talking about
memory consumption in the compiler - many optimizations do. In
particular, inlining requires a lot of compile time and compile
memory; you can restrict this with -fno-inline or -finline-limit-N. I
don't think there is a way to turn on only the cheap optimizations
(except, perhaps, -O1) - you'll have to turn off the expensive ones.
See (gcc)Optimize Options for details.
Martin