inlining or not inlining...

ivan pavlov at pavlov.org
Sat Feb 12 05:53:33 PST 2011


ivan Wrote:

> Jim Wrote:
> 
> > spir Wrote:
> > 
> > > On 02/12/2011 12:15 PM, Jim wrote:
> > > > Sorry about that, but I think that is a closely related discussion. @inline is certainly a verb -- even imperative mood, so not just asking for information.
> > > > Why do you need information if you can't affect the outcome?
> > > 
> > > I want to know it. First, because it's valuable information in and by itself. 
> > > Second, because it teaches me something. Third, because I can then possibly 
> > > decide to not factor out (may be wrong, but still, I can measure...).
> > > Glasnost for compilers! ;-)
> > 
> > Glasnost! :)
> > 
> > How about the meta-namespace then:
> > 
> > static if( meta.inlined )
> > {
> >    writeln("got it!");
> > }
> > 
> 
> Why not:
> 
> void foo() { printf("da\n"); }
> 
> const bool bar = @glasnost.inlined(foo);
> 
> or
> 
> const bool bar = __glasnost << inlined!foo;
> 

In general we need traits for discovering all optimizations:

pragma(msg, __traits.optimizations.tupleof(foo).stringof);

// results as an example in: ("loop unfolding", "sse2 multiplication", "inline-strong-pass", "tail-call optimization")


More information about the Digitalmars-d mailing list