Age | Commit message (Collapse) | Author |
|
Since we do 8-byte loads for va_arg of double, make sure the vararg buffer
alloca is 8-byte aligned.
|
|
This patch also lays the groundwork for the single-use instruction trick to
reduce the number of temporary variables.
|
|
|
|
|
|
normal js args to be passed, and disable unneeded createExpandSmallArgumentsPass
|
|
|
|
Although PNaCl doesn't fully support struct types as varargs
arguments, there is a test in Spec2k (255.vortex) that passes a struct
as a varargs argument but never reads the argument using va_arg (which
is legal, but strange).
ExpandVarArgs was handling the struct argument by copying it with a
struct load+store. This is undesirable because currently SROA
converts that into code that uses extractvalue, which was rejected by
the PNaCl ABI checker. Struct load/store will soon be rejected by the
ABI checker too.
We could fix this by running ExpandStructRegs after ExpandVarArgs, but
it's cleaner for ExpandVarArgs to use memcpy() instead of struct
load+store. memcpy() is potentially more efficient because it avoids
having a temporary copy of the struct, and using memcpy() avoids
dependencies between IR passes.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3338
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343
TEST=*.ll tests + built 255.vortex from Spec2k
Review URL: https://codereview.chromium.org/16232021
|
|
This widens i1, i8 and i16 function arguments and return types.
Factor out RecreateFunction() helper function from existing PNaCl
passes since this is a reoccurring code fragment.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3342
TEST=*.ll tests + PNaCl toolchain trybots + GCC torture tests + LLVM test suite
Review URL: https://codereview.chromium.org/15971007
|
|
ReplacePtrsWithInts converts IR to a normal form in which functions
don't reference any aggregate pointer types and pointer types only
appear inside a few instructions.
Change BlockAddress::replaceUsesOfWithOnConstant() to handle changing
a function's type by replacing a function with a bitcast ConstantExpr
of a new function.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343
TEST=replace-ptrs-with-ints.ll + PNaCl toolchain trybots, torture tests, etc.
Review URL: https://codereview.chromium.org/14262011
|
|
This could help prevent these expansion passes from inhibiting
optimisations than run after the expansion. e.g. It gives the
optimiser more freedom to move around reads from the varargs buffer
because they will not alias writes to other locations.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3400
TEST=PNaCl toolchain trybots + GCC torture tests + LLVM test suite + Spec2k
Review URL: https://codereview.chromium.org/14060026
|
|
Saves a tiny bit of space for var-args heavy bitcode
programs, since the anonymous types get unique'ed. E.g.,
saves 20KB out of 1.6MB in spec gcc when comparing the
gzipped files, or about 100KB when not zipped. This is only
a savings with the current wire format. If we change the
alloca, etc. to only have sizes and not struct types
then we would also not have this duplication.
Just happened to notice while looking through code for
what struct types remain used in the bitcode.
random cleanup for:
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3338
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/14197004
|
|
I've encountered two uses of va_arg on an empty argument list: NaCl's
open() wrapper (now fixed), and 176.gcc in Spec2k. Although this is
invalid use of va_arg (giving undefined behaviour), it's too awkward
to fix 176.gcc.
Work around this invalid usage by ensuring that the argument list
pointer points to a location on the stack rather than being
uninitialised. va_arg will return undefined values as it does in the
usual native ABIs, rather than crashing.
We could add options for non-strict and strict modes (possibly with a
bounds check), but that's too much complication for now.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3338
TEST=test/Transforms/NaCl/*.ll + ran 176.gcc from Spec2k
Review URL: https://codereview.chromium.org/13510004
|
|
* Ensure that the "byval" attribute is preserved for the fixed
arguments. Before, it was stripped off from function calls but
left in for function definitions, which broke passing struct
arguments (which PNaCl Clang generates as "byval").
* Ensure that function and return attributes are preserved too.
* Handle "byval" variable arguments in calls too by dereferencing the
pointer. These are not yet usable with PNaCl Clang, which does not
allow va_arg on structs (see
https://code.google.com/p/nativeclient/issues/detail?id=2381), but
we might as well make this pass ready to handle this.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3338
TEST=test/Transforms/NaCl/expand-varargs*.ll
Review URL: https://codereview.chromium.org/13100002
|
|
Once this pass is enabled, it will simplify the language to reduce the
set of constructs that a PNaCl translator needs to handle as part of a
stable wire format for PNaCl.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3338
TEST=test/Transforms/NaCl/expand-varargs.ll
Review URL: https://codereview.chromium.org/12481021
|