Hi Alon,

I've been thinking about upstreaming PNaCl's LLVM IR simplification passes
to LLVM, which would be useful for Emscripten if you're going to reuse
these passes for Emscripten's new backend (
https://github.com/kripken/emscripten/wiki/LLVM-Backend).

Which of the passes do you think we should upstream first?  Which are most
useful to Emscripten?  I expect it will be easier to make the case for
upstreaming a pass if it is used by both PNaCl and Emscripten. :-)

Here's a list of PNaCl's IR simplification passes, in decreasing order of
what I'm guessing their usefulness to Emscripten would be.

These are probably useful in any case:
 * ExpandCtors
 * PromoteIntegers
 * ExpandArithWithOverflow -- I don't think Emscripten can optimise these
better, unless new operations are added to Javascript?
 * ExpandStructRegs
 * ResolveAliases

These two would be useful for initial bring-up, though I suspect Emscripten
could produce slightly more efficient code by the stack pointer explicitly
(which PNaCl can't do because it doesn't have an explicit stack pointer):
 * ExpandVarArgs
 * ExpandByVal

These might allow the backend to be a little simpler:
 * FlattenGlobals -- simplifies later lowering?
 * ExpandConstantExpr -- simplifies later lowering?
 * ExpandGetElementPtr -- a minor help
 * CanonicalizeMemIntrinsics
 * ReplacePtrsWithInts -- might only be useful for the explicit trunc/zexts
it inserts (to avoid casts between pointers and non-i32 ints), which could
be done by a simpler pass

I don't expect these would be useful:
 * ExpandSmallArguments -- Emscripten wants to promote all i8/i16s, not
just arguments and return values
 * PromoteI1Ops - similar: too specific?
 * StripMetadata - not useful: backend can just ignore metadata
 * StripAttributes - ditto
 * ExpandTls - The variable allocation part could be useful, though, if
separated out.  Would also be useful if/when Emscripten supports pthreads
in some form (e.g. via web workers with shared memory).

What do you think?

Cheers,
Mark

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to