[cfe-dev] feasibility of C++ to inline-assembly using clang

Eli Friedman eli.friedman at gmail.com
Sun Mar 14 21:48:14 PDT 2010


On Sun, Mar 14, 2010 at 8:57 PM, David Tweed <david.tweed at gmail.com> wrote:
> In case anyone asks "why do I want to do this strange thing?", I'm
> looking at the feasibility of writing compute heavy code web-apps
> using Google's NativeClient technology (in C++). This requires that
> the final binary be compiled from source by the latest version of the
> native client C++ compiler, which is a patched version of some
> uncontrollable version of g++ (unless I want to try and manually port
> the particular patches to a different g++ version). Unfortunately the
> g++ optimizers/schedulers are oscillate from release to release for
> very performance sensitive inner loops. Given that I'd still very much
> prefer to write C++ rather than raw assembly for the "inner loop-y"
> functions I'm looking at ways to separate the generation and
> optimisation of this code from the need to be via the latest native
> client compiler. (Clang/llvm seem to have a much better separation of
> concerns than gcc, so I'd think it'd be easier for me to modify it to
> output appropriate asm constructs than g++. )

Umm, are you planning on making LLVM support NativeClient-style code
generation?  Unless I'm mistaken, general inline asm will make your
program fail validation by the NativeClient sandbox.

Also, I don't see the point; why can't you just put the
performance-sensitive function in its own file, compile it to a .s
file, and add that to your project?

-Eli



More information about the cfe-dev mailing list