OSDN Git Service

android-x86/external-swiftshader.git
8 years agoSubzero: Refine the memory usage report with -szstats .
Jim Stichnoth [Thu, 31 Mar 2016 18:05:39 +0000 (11:05 -0700)]
Subzero: Refine the memory usage report with -szstats .

The problem is that the memory usage that comes from the -track-memory option is not very well-defined (it's a hidden LLVM option after all).  It gives an OK sense of memory growth over time, but sometimes we really want to know how much CFG-local arena memory was allocated for a particular function.

To help with this, we add another row to the stats output, giving the MB size of the CFG arena at the end of translating the method.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4366
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/1848733002 .

8 years agoAllow Subzero to parse function blocks in parallel.
Karl Schimpf [Thu, 31 Mar 2016 17:20:23 +0000 (10:20 -0700)]
Allow Subzero to parse function blocks in parallel.

This CL modifies the code so that we can do sequential and parallel
parsing of function blocks in bitcode files, based on a command line
argument.

The command line argument was added because during testing, I had one
compilation failure (transient), and do not know the cause. Hence, I
was reluctant to install this CL without a command-line flag.

To test the new parallel parser, the easiest solution is to edit
IceClFlags.def and set the default value of ParseParallel to true.

This code also fixes up unit parsing tests, as well as one parsing
test.  The cause of these problems was the implicit assumption that
function blocks are parsed sequentially, which no longer applies when
function blocks are parsed in parallel. To fix this, the "threads=0"
command line argument was added. It also added the starting up of
worker threads, since parsing of function blocks will happen in the
translation thread if parallel parsing is turned on.

The OptQ queue was modified to contain OptWorkerItem instances with a
single virtual to get the parsed code. This allows the IceConverter to
continue to work, by simply passing the generated Cfg as a work item.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4363
R=jpp@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1834473002 .

8 years agoSubzero: Fix a bug in advanced phi lowering.
Jim Stichnoth [Wed, 30 Mar 2016 22:30:30 +0000 (15:30 -0700)]
Subzero: Fix a bug in advanced phi lowering.

The motivating example (simplified) is this:

%__698:eax = phi i32 [ %__646:ebx, %__188 ] // LIVEEND={%__646:ebx}
%__617:bh =  phi i8  [ %__618:ah,  %__188 ] // LIVEEND={%__618:ah}
%__615:bl =  phi i8  [ %__616:al,  %__188 ] // LIVEEND={%__616:al}

By default, it first lowers the __698 assignment.  However, that assignment has two "predecessors" because there are two other instructions whose dest variable aliases the __698 assignment's source operand.  This triggers an assertion failure where we assume there is only one predecessor.

The fix is two-pronged.  First, we go ahead and generate as many temp assignments as needed to break the cycle, simply by changing an "if" to a "while".  Second, when we need to break a cycle, we give preference to an instruction with only one predecessor so that only one temp assignment needs to be added.

(It might be possible to prove that the second approach, i.e. preferring single-predecessor assignments, makes the first approach unnecessary, i.e. changing "if" to "while".)

This change has no effect on the x86 output for spec2k.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4365
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1839263003 .

8 years agoSubzero: Remove IceString.
Jim Stichnoth [Tue, 29 Mar 2016 22:01:06 +0000 (15:01 -0700)]
Subzero: Remove IceString.

The purpose is to get control over excess string creation and deletion, especially when the strings are long enough to involve malloc/free.

Strings that interface with the outside world, or used for dump/debug, are now explicitly std::string.

Variable names and node names are represented as string IDs and pooled locally in the CFG.  (In a non-DUMP build, this pool should always be empty.)

Other strings that are used across functions are represented as string IDs and pooled globally in the GlobalContext.

The --dump-strings flag allows these strings to be dumped for sanity checking, even in a MINIMAL build.  In a MINIMAL build, the set of strings includes external symbol names, intrinsic names, helper function names, and label names of pooled constants to facilitate deterministic ELF string table output.  For now, it also includes jump table entry names until that gets sorted out.

Constants are fixed so that the name and pooled fields are properly immutable after the constant is fully initialized.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4360
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1838753002 .

8 years agoFix Subzero binary instruction to allow optional flags argument.
Karl Schimpf [Fri, 25 Mar 2016 14:12:26 +0000 (07:12 -0700)]
Fix Subzero binary instruction to allow optional flags argument.

This CL fixes pnacl-sz to handle smoothnacl.pexe.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4364
R=jpp@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1831043002 .

8 years agoSubzero. Fixes valgrind errors.
John Porto [Thu, 24 Mar 2016 13:11:29 +0000 (06:11 -0700)]
Subzero. Fixes valgrind errors.

Valgrind used to report errors about uninitialized variable access in
Subzero, when it was built with -O2. The problem was traced to

size_t Alignment = Var->getAlignment;
Alignment = std::max(MinAlignment, Var->getAlignment())

Apparently, the compiler will not correctly zero-extend
Var->getAlignment(), and thus Alignment's upper 32-bits would be
garbage.

BUG=
R=kschimpf@google.com, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1825363003 .

8 years agoSubzero: Fix the broken "make presubmit-lite".
Jim Stichnoth [Mon, 21 Mar 2016 21:53:03 +0000 (14:53 -0700)]
Subzero: Fix the broken "make presubmit-lite".

BUG= none
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/1819153002 .

8 years agoSubzero: Add presubmit-lite target.
Jim Stichnoth [Mon, 21 Mar 2016 19:49:33 +0000 (12:49 -0700)]
Subzero: Add presubmit-lite target.

The big reduction is in greatly reducing the set of non-native cross tests.  Also, not so many copies of spec2k are run, and only one "representative" sandboxed target is built.

BUG= none
R=eholk@chromium.org

Review URL: https://codereview.chromium.org/1824723002 .

8 years agoSubzero. Flags refactoring.
John Porto [Mon, 21 Mar 2016 18:18:02 +0000 (11:18 -0700)]
Subzero. Flags refactoring.

BUG=
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1803403002 .

8 years agoAdd malloc/new profiling on linux
David Sehr [Thu, 17 Mar 2016 20:51:42 +0000 (13:51 -0700)]
Add malloc/new profiling on linux

BUG=
R=jpp@chromium.org, kschimpf@google.com, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1781213002 .

8 years agoCache common constants before lowering.
Karl Schimpf [Thu, 17 Mar 2016 20:30:13 +0000 (13:30 -0700)]
Cache common constants before lowering.

This code moves some constants used by the target lowering, so that they
are defined (and cached) during static initialization of the target
lowering, rather than looking up everytime they are used.

This CL does this for the constant zero, and predefined helper functions.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=jpp@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1775253003 .

8 years agoSuzero. Refactors dependencies in Makefile.standalone.
John Porto [Wed, 16 Mar 2016 11:20:49 +0000 (04:20 -0700)]
Suzero. Refactors dependencies in Makefile.standalone.

Uses the compiler's frontend -MD -MP options to auto-generate make
dependencies.

BUG=
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1801273003 .

8 years agoSubzero: Shorten global prefixes in non-DUMP build.
Jim Stichnoth [Tue, 15 Mar 2016 18:09:32 +0000 (11:09 -0700)]
Subzero: Shorten global prefixes in non-DUMP build.

Reverts part of 843142fe (https://codereview.chromium.org/1776343004).

Makes global prefixes short in all non-DUMP builds, not just the browser
build, so that the user doesn't need to remember to supply the override
options in a command-line MINIMAL build.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1805593002 .

8 years agoSubzero. Uses unique_ptrs in the emit queue.
John Porto [Tue, 15 Mar 2016 18:06:25 +0000 (11:06 -0700)]
Subzero. Uses unique_ptrs in the emit queue.

Because explicit memory ownership is awesome!

BUG=
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1804133002 .

8 years agoSubzero. Allocate global initializers from a dedicated arena.
John Porto [Tue, 15 Mar 2016 16:28:04 +0000 (09:28 -0700)]
Subzero. Allocate global initializers from a dedicated arena.

This allows Subzero to release the global initializers once they've been
lowered.

This CL also modifies the global initializer types to ensure they are
trivially destructible -- therefore not requiring destructors to run.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4360
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1776473007 .

8 years agoSubzero: Control whether deleted instructions are retained.
Jim Stichnoth [Mon, 14 Mar 2016 15:37:52 +0000 (08:37 -0700)]
Subzero: Control whether deleted instructions are retained.

Normally, deleted instructions are preserved in the Cfg, and printed as part of dump output.  This helps debugging by partially explaining the provenance of new instructions that originated from the deleted instructions.

However, these instructions slow down iteration over the instruction list, and checking their deleted status may pollute the cache.

As such, in a non-DUMP enabled build, we repurpose the renumberInstructions() pass to also unlink deleted instructions as needed.

A flag is provided to override this behavior, in case we have to debug a situation where a bug only manifests in a DUMP build and not a non-DUMP build, or vice versa.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4360
R=eholk@chromium.org, jpp@chromium.org

Review URL: https://codereview.chromium.org/1790063003 .

8 years agoSubzero: Allow Makefile.standalone to build for a single target.
Jim Stichnoth [Sat, 12 Mar 2016 18:22:53 +0000 (10:22 -0800)]
Subzero: Allow Makefile.standalone to build for a single target.

This makes it easier to focus on reducing the translator size.

Enable with e.g.:
  make -f Makefile.standalone MINIMAL=1 SZTARGET=X8664 bloat-sb

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4362
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1787143002 .

8 years agoSubzero: Fix the Makefile for the LLVM build.
Jim Stichnoth [Sat, 12 Mar 2016 18:04:08 +0000 (10:04 -0800)]
Subzero: Fix the Makefile for the LLVM build.

https://codereview.chromium.org/1784243006/ added the ALLOW_TIMERS define, and I forgot to add it to Makefile and CMakeLists.txt.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1788873004 .

8 years agoSubzero: Improve the use of timers.
Jim Stichnoth [Fri, 11 Mar 2016 23:33:00 +0000 (15:33 -0800)]
Subzero: Improve the use of timers.

Several things are done here:

1. Move timer support to be guarded by the ALLOW_TIMERS define, or the BuildDefs::timers() constexpr method.

2. Add a NODUMP build configuration to control whether dump support is built in.  So "make -f Makefile.standalone NODUMP=1 NOASSERT=1" is pretty close to a MINIMAL build with timer support.

3. Add some missing timers: alloca analysis, RMW analysis, helper call pre-lowering, load optimization analysis.  These omitted pass timings were being rolled up into the "O2" bucket.

4. Add timers around push and pop operations on the translate queue and the emit queue.

5. Refactor the clumsy code to push/pop function timers (as opposed to pass timers), so that it fits into the nice RAII TimerMarker class like the pass timers.

6. It turns out that even with MINIMAL or NODUMP builds, we still construct a longish std::string every time Cfg::dump() is called, even though the string isn't used in MINIMAL/NODUMP mode.  The dump() arg might as well be a const char * arg instead.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4360
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/1784243006 .

8 years agoSubzero: Improve the behavior of resizing vectors.
Jim Stichnoth [Fri, 11 Mar 2016 22:59:43 +0000 (14:59 -0800)]
Subzero: Improve the behavior of resizing vectors.

In some cases, Subzero needs to insert into a std::vector at a particular index, resizing the vector as necessary.  It appears that our vector implementation sets the capacity to exactly the size when growing the vector, without leaving any extra capacity.  This causes lots of mallocs and recopies each time the vector size is increased.  (Adding elements via push_back() or emplace_back() doesn't seem to have that behavior.)

We help this by reserving some extra space before resizing - bump to the next power of 2 up to some point, then bump to the next multiple of a chunk size beyond that point.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4360
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/1783113002 .

8 years agoSubzero: 'make presubmit' checks for certain prerequisites.
Jim Stichnoth [Fri, 11 Mar 2016 22:58:23 +0000 (14:58 -0800)]
Subzero: 'make presubmit' checks for certain prerequisites.

A fresh checkout of native_client lacks some components that Subzero's "make -f Makefile.standalone presubmit" needs.

Add explicit checks for these components, and when missing, print suggestions for how to create them.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4359
R=jpp@chromium.org, smklein@chromium.org

Review URL: https://codereview.chromium.org/1782343003 .

8 years agoPNaCl Dynamic Linking: Force __pnacl_pso_root to be an external declaration.
Sean Klein [Fri, 11 Mar 2016 17:49:36 +0000 (09:49 -0800)]
PNaCl Dynamic Linking: Force __pnacl_pso_root to be an external declaration.

This CL updates "isPNaClABIExternalName" -- Subzero checked for the symbol
"__pnacl_pso_root" as a function, but it is a declaration, and should be
checked as one. Additionally, when the PNaClTranslator is verifying the linkage
of declarations, allow "__pnacl_pso_root" to be flipped to external as a special
case.

Previously, translating a pso with --use-sz caused the warning:
"cannot find entry symbol '__pnacl_pso_root'".
That warning is removed with this CL.

Fixes revert from https://codereview.chromium.org/1745783002/

TEST=external_declaration.ll
BUG=https://bugs.chromium.org/p/nativeclient/issues/detail?id=4351
R=kschimpf@google.com, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1774383002 .

8 years agoSubzero. X8664. No moar ::new for AutoBundle.
John Porto [Thu, 10 Mar 2016 18:59:02 +0000 (10:59 -0800)]
Subzero. X8664. No moar ::new for AutoBundle.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4360
BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4077
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1783893002 .

Patch from John Porto <jpp@chromium.org>.

8 years agoRe-fix build errors from upgrading to clang 3.9 .
Jim Stichnoth [Thu, 10 Mar 2016 16:19:34 +0000 (08:19 -0800)]
Re-fix build errors from upgrading to clang 3.9 .

This reverts commit 5526c1718b43d77d90850ec0409a21ecfc975b2c (https://codereview.chromium.org/1778663003) and implements it per jpp's suggestion.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1780773003 .

8 years agoEliminate all uses of 'le32-nacl-objcopy'.
Sean Klein [Wed, 9 Mar 2016 23:26:41 +0000 (15:26 -0800)]
Eliminate all uses of 'le32-nacl-objcopy'.

Additionally, refactor "GetObjdumpCmd" and "GetObjcopyCmd".

BUG=https://bugs.chromium.org/p/nativeclient/issues/detail?id=4361
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1777103002 .

8 years agoSubzero: Tweaks to reduce malloc use.
Jim Stichnoth [Wed, 9 Mar 2016 23:19:40 +0000 (15:19 -0800)]
Subzero: Tweaks to reduce malloc use.

1. Subzero constructs many strings based in part on function name.  When function names are not present (as in properly finalized pexes), they are synthesized as something like "Function12345".  We can shorten these strings to e.g. "F12345" by using --default-function-prefix=F .  Similar for global variable names.

Using short strings makes it much less likely to have to use malloc.  As such, we force that to be the default in the browser translator build.  For perf-testing the command-line version, the user can just add the option manually for now.

Ultimately, we should avoid use of strings in this way.

2. The register allocator uses a few instances of llvm::SmallVector that are sized too small and therefore end up using malloc.  This can be fixed in a clean way, and there is a TODO for it, but in the meantime we just bump the size.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4360
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1776343004 .

8 years agoAllow subzero tests to pass without le32-nacl-objdump.
Sean Klein [Wed, 9 Mar 2016 18:29:54 +0000 (10:29 -0800)]
Allow subzero tests to pass without le32-nacl-objdump.

le32-nacl-objdump has been deprecated, and should no longer be used.
Instead, "arm-nacl-objdump" is being used. "le32-nacl-objdump" used to be
a hard link to "arm-nacl-objdump", but has since been deleted in NaCl's
"toolchain_build_pnacl.py" script.

R=phosek@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1776843002 .

8 years agoSubzero: Fix build errors from upgrading to clang 3.9 .
Jim Stichnoth [Wed, 9 Mar 2016 06:46:19 +0000 (22:46 -0800)]
Subzero: Fix build errors from upgrading to clang 3.9 .

BUG= none
TBR=jpp@chromium.org

Review URL: https://codereview.chromium.org/1778663003 .

8 years agoSubzero: Control memory growth from local label fixups.
Jim Stichnoth [Wed, 9 Mar 2016 00:18:40 +0000 (16:18 -0800)]
Subzero: Control memory growth from local label fixups.

The ConstantRelocatable objects for pushing local labels are allocated from the Assembler arena, and are no longer pooled, which restricts the memory growth from sandboxing x86-64 calls.

Because the Assembler arena is destroyed while the fixups are still active, these fixups have to be fixed up by holding a pointer to the symbol rather than the constant.

On the 10MB test pexe, the overall growth by the end is ~20MB, instead of ~130MB as before.

This also partially fixes an existing bug with arm32/nonsfi/iasm, exposed by running cross tests and forcing iasm output.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1773503003 .

8 years agoFix timing of parseFunctions.
Karl Schimpf [Tue, 8 Mar 2016 20:27:12 +0000 (12:27 -0800)]
Fix timing of parseFunctions.

The previous implementation was charging about 24% more time that it
should to the function parser. The cause was that the time to "queue" the
parsed functions, and the time to emit the assembled code (again
including "queue" time) was not accounted for. About 15% was going to
queuing costs, and 7% to emitting the ELF file.

This CL adds timing of function translateFunctions, which captures most
of the queueing costs, and timing for each of the major ELF emission
functions (emitELF). This allows the corresponding costs to be better
bucketed, and not charged to the time it takes to parse functions in
bitcode files.

Bug=None

R=jpp@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1775603002 .

8 years agoSubzero. ARM32. Fix bugs uncovered by scons tests.
John Porto [Tue, 8 Mar 2016 19:00:53 +0000 (11:00 -0800)]
Subzero. ARM32. Fix bugs uncovered by scons tests.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=eholk@chromium.org, kschimpf@google.com, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1768823002 .

8 years agoSubzero: Fix "make presubmit" for spec -Om1.
Jim Stichnoth [Mon, 7 Mar 2016 17:54:15 +0000 (09:54 -0800)]
Subzero: Fix "make presubmit" for spec -Om1.

For the Om1 spec tests, we were generating commands like this:

  ./pydir/szbuild_spec2k.py -v -Om1 --target=x8632 -O2 --filetype=obj 253.perlbmk

where -Om1 and -O2 both appear.  Python's argparse allows an argument to be set multiple times, and the last one would win, i.e. -O2 is used instead of -Om1.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1766603002 .

8 years agoSubzero: Fix symbol name mangling. Make flags global.
Jim Stichnoth [Mon, 7 Mar 2016 17:26:22 +0000 (09:26 -0800)]
Subzero: Fix symbol name mangling. Make flags global.

This cleans up the whole --prefix handling mechanism, so that all mangling is done based on logic in the parser instead of scattered all over the code base.  Another nice side effect is that it allows some getName() style functions to return a const string reference instead of a string copy.

Also, moves ClFlags into a static field of GlobalContext, i.e. makes it global, so that these constant flags can be accessed without having to plumb a GlobalContext object.  Note that some of the ClFlags and ClFlagsExtra plumbing in the compile server classes could be simplified to directly use the corresponding static fields, but this is left mostly as is for now, for when we do a proper separation between core and supplemental flags.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1766233002 .

8 years agoSubzero: Count lookups of each constant value in the constant pool.
Jim Stichnoth [Mon, 7 Mar 2016 16:25:24 +0000 (08:25 -0800)]
Subzero: Count lookups of each constant value in the constant pool.

With "-verbose cpool", at the end it dumps counts of the number of times each pooled constant was looked up.  The output is grouped by type and sorted by constant value, but it's easy to run it through "sort -nr" to see it ordered by popularity.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1768173002 .

8 years agoSubzero. ARM32. Fixes bugs uncovered by the llvm test suite.
John Porto [Wed, 2 Mar 2016 23:10:19 +0000 (15:10 -0800)]
Subzero. ARM32. Fixes bugs uncovered by the llvm test suite.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1755333002 .

8 years agoSubzero. ARM32. Fixes bugs uncovered by the gcc torture tests.
John Porto [Tue, 1 Mar 2016 23:19:29 +0000 (15:19 -0800)]
Subzero. ARM32. Fixes bugs uncovered by the gcc torture tests.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1747243003 .

8 years agoSubzero: Print constant pool info with --szstats.
Jim Stichnoth [Tue, 1 Mar 2016 20:22:29 +0000 (12:22 -0800)]
Subzero: Print constant pool info with --szstats.

BUG= none
R=eholk@chromium.org, jpp@chromium.org

Review URL: https://codereview.chromium.org/1747333002 .

8 years agoSubzero. ARM32. Reverts cl 1687553002.
John Porto [Tue, 1 Mar 2016 14:11:05 +0000 (06:11 -0800)]
Subzero. ARM32. Reverts cl 1687553002.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1745393002 .

8 years agoSubzero: Reduce copying of Liveness bitvectors.
Jim Stichnoth [Tue, 1 Mar 2016 00:58:15 +0000 (16:58 -0800)]
Subzero: Reduce copying of Liveness bitvectors.

There were a lot of unnecessary copying and resizing and sloppiness in the use of BitVector for liveness analysis.  This tries to reduce the amount of copying and associated memory allocation.

Also, works around a ConstantRelocatable hashing problem that was causing a huge slowdown in MINIMAL mode for the vector_shuffle scons test.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1746613002 .

8 years agoFix clang warning "has virtual functions but non-virtual destructor".
Sean Klein [Tue, 1 Mar 2016 00:44:07 +0000 (16:44 -0800)]
Fix clang warning "has virtual functions but non-virtual destructor".

BUG= None
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1741733003 .

8 years agoSubzero: Fix JumpTable lowering on x86-64.
Jim Stichnoth [Mon, 29 Feb 2016 17:54:55 +0000 (09:54 -0800)]
Subzero: Fix JumpTable lowering on x86-64.

The problem is that when switch lowering decides to use a JumpTable and the switch variable is i64 on x86-64, the lowering tries to movzx the i64 variable into an i32 variable, and the Movzx ctor asserts.

This happens when translating pnacl-llc.pexe, but luckily it is also triggered in the existing adv-switch.ll test.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1743133002 .

8 years agoSubzero: Add "-verbose init" to control global initializer dumping.
Jim Stichnoth [Mon, 29 Feb 2016 17:34:01 +0000 (09:34 -0800)]
Subzero: Add "-verbose init" to control global initializer dumping.

One is rarely interested in seeing dump output regarding global initializers, so we add an additional verbose flag, and don't include it in the "-verbose most" set.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1744913002 .

8 years agoSubzero: Build sandboxed translators for the browser.
Jim Stichnoth [Mon, 29 Feb 2016 17:16:00 +0000 (09:16 -0800)]
Subzero: Build sandboxed translators for the browser.

Along with the nexe equivalents of pnacl-sz, also build the browser-integrated versions that can be dropped in as replacements.  Note that these are not exact replacements, as they likely support all targets.

In "make presubmit", instead build sandboxed translators in DEBUG=1 mode, so they can build in parallel with the assembler unit tests.

Add a "make bloat-sb" target that does the "make bloat" equivalent for the sandboxed translators.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1746593002 .

8 years agoRevert "Force __pnacl_pso_root to be an external declaration."
Jim Stichnoth [Mon, 29 Feb 2016 17:14:11 +0000 (09:14 -0800)]
Revert "Force __pnacl_pso_root to be an external declaration."

This reverts commit 352db9354e9c30f99c6f87674f70a6f23a9ef7eb from https://codereview.chromium.org/1740033002/ .

That commit broke "make -f Makefile.standalone check-lit check-xtest".

BUG= none
R=smklein@chromium.org

Review URL: https://codereview.chromium.org/1745783002 .

8 years agoSubzero: Print memory usage info when dumping.
Jim Stichnoth [Sat, 27 Feb 2016 17:05:50 +0000 (09:05 -0800)]
Subzero: Print memory usage info when dumping.

Adds "-verbose mem" to enable printing the amount of CfgLocalAllocator memory allocated, each time Cfg::dump() is called.

"-verbose mem,status" is a good way to get summary info.

BUG= none
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/1743043002 .

8 years agoForce __pnacl_pso_root to be an external declaration.
Sean Klein [Fri, 26 Feb 2016 22:34:38 +0000 (14:34 -0800)]
Force __pnacl_pso_root to be an external declaration.

This CL updates "isPNaClABIExternalName" -- Subzero checked for the symbol
"__pnacl_pso_root" as a function, but it is a declaration, and should be
checked as one. Additionally, when the PNaClTranslator is verifying the linkage
of declarations, allow "__pnacl_pso_root" to be flipped to external as a special
case.

TEST=pnacl-translate -pso --use-sz -arch x86-32-nonsfi test_pll.final.pso
BUG=https://bugs.chromium.org/p/nativeclient/issues/detail?id=4351
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1740033002 .

8 years agoSubzero. Fix CfgLocalAllocator bug.
John Porto [Fri, 26 Feb 2016 21:10:55 +0000 (13:10 -0800)]
Subzero. Fix CfgLocalAllocator bug.

BUG=

Review URL: https://codereview.chromium.org/1742833002 .

8 years agoSubzero. Moar performance tweaks.
John Porto [Fri, 26 Feb 2016 15:19:59 +0000 (07:19 -0800)]
Subzero. Moar performance tweaks.

1) Clones llvm::BitVector, and makes it Allocator aware (using the
CfgLocalAllocator<>)

2) Uses mallopt to set the malloc granularity. The default granularity
is too small, which forces too many mmap calls.

BUG=
R=sehr@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1738683003 .

8 years agoSubzero: Fix ODR errors in the g++ build.
Jim Stichnoth [Thu, 25 Feb 2016 08:13:46 +0000 (00:13 -0800)]
Subzero: Fix ODR errors in the g++ build.

See failed build at https://build.chromium.org/p/tryserver.nacl/builders/nacl-toolchain-win7-pnacl-x86_64/builds/3441 .

BUG= none
TBR=jpp@chromium.org

Review URL: https://codereview.chromium.org/1732233002 .

8 years agoSubzero: Provide "make sb" target for sandboxed pnacl-sz.
Jim Stichnoth [Thu, 25 Feb 2016 05:32:53 +0000 (21:32 -0800)]
Subzero: Provide "make sb" target for sandboxed pnacl-sz.

Instead of "./pnacl-sz <args>", one can run:

  ../../../run.py ./pnacl-sz.x8632.nexe <args>
or
  ../../../run.py ./pnacl-sz.x8664.nexe <args>

Hopefully the translator performance characteristics are close to that of the browser hookup.

Adds sb builds to two of the presubmit configurations.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1738633002 .

8 years agoSubzero. Performance tweaks.
John Porto [Wed, 24 Feb 2016 23:58:55 +0000 (15:58 -0800)]
Subzero. Performance tweaks.

Introduces Ice::SmallBitVector.

Modifies ConstantRelocatables so that known offsets (i.e.,
not offsets to the code stream) do no require GlobalContext
allocations.

Modifies Cfg-local containers to use the CfgLocalAllocator.

BUG=
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1738443002 .

8 years agoSubzero: Add missing bits to MIPS implementation.
Jim Stichnoth [Wed, 24 Feb 2016 15:05:12 +0000 (07:05 -0800)]
Subzero: Add missing bits to MIPS implementation.

TBR=jpp@chromium.org

BUG= none

Review URL: https://codereview.chromium.org/1730263002 .

8 years agoSubzero: Basic unconditional branch for Mips.
Reed Kotler [Wed, 24 Feb 2016 02:59:43 +0000 (18:59 -0800)]
Subzero: Basic unconditional branch for Mips.

This is part of ARM patch:
https://codereview.chromium.org/1151663004/

BUG=
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1724643002 .

Patch from Reed Kotler <rkotlerimgtec@gmail.com>.

8 years agoSubzero: implement 64 bit multiply in mips32
Reed Kotler [Sat, 20 Feb 2016 06:03:29 +0000 (22:03 -0800)]
Subzero: implement 64 bit multiply in mips32

Implement 64 bit multiply in mips32 and, in addition, add the lo/hi registers which are also used for other 64 bit math such as div, rem.

BUG=
R=jpp@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1716483003 .

Patch from Reed Kotler <rkotlerimgtec@gmail.com>.

8 years agoSubzero. ARM32. Enable hwdiv-arm crosstests.
John Porto [Thu, 18 Feb 2016 16:02:10 +0000 (08:02 -0800)]
Subzero. ARM32. Enable hwdiv-arm crosstests.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=eholk@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1708753002 .

8 years agoSubzero. ARM32. Enable more crosstests.
Eric Holk [Wed, 17 Feb 2016 23:47:22 +0000 (15:47 -0800)]
Subzero. ARM32. Enable more crosstests.

This removes most of the #ifndef ARM32 directives so we get more
thorough testing. It still uses fewer iterations due to running on
Qemu, but I did manually check to be sure that the tests pass without
any special casing at all.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=jpp@chromium.org, kschimpf@google.com

Review URL: https://codereview.chromium.org/1708903002 .

8 years agoARM32 vector lowering: fabs, scalarize remaining arithmetic operations.
Eric Holk [Wed, 17 Feb 2016 21:03:29 +0000 (13:03 -0800)]
ARM32 vector lowering: fabs, scalarize remaining arithmetic operations.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1685253003 .

8 years agoARM32 Vector lowering - scalarize select
Eric Holk [Wed, 17 Feb 2016 19:09:48 +0000 (11:09 -0800)]
ARM32 Vector lowering - scalarize select

With this change, we pass the select crosstest.

Since this would have introduced a three-argument version of
scalarizeInstruction, I decided to generalize it using templates.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1683243003 .

8 years agoSubzero. Removes X8664_STACK_HACK from the crosstests.
John Porto [Wed, 17 Feb 2016 18:16:12 +0000 (10:16 -0800)]
Subzero. Removes X8664_STACK_HACK from the crosstests.

X8664_STACK_HACK was an intrusive way to get the crosstests to run
while x32 support was not implemented in llvm. The hack is longer
needed.

R=eholk@chromium.org

Review URL: https://codereview.chromium.org/1706883003 .

8 years agoAdd fabs(<4 x float>) to the integrated ARM assembler.
Karl Schimpf [Wed, 17 Feb 2016 17:51:23 +0000 (09:51 -0800)]
Add fabs(<4 x float>) to the integrated ARM assembler.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=eholk@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1697263007 .

8 years agoThis would eliminate a lot of repetitive coding in subzero.
Reed Kotler [Wed, 17 Feb 2016 13:37:01 +0000 (05:37 -0800)]
This would eliminate a lot of repetitive coding in subzero.
It's troublesome that we have to type (this) in several places
but I don't see a away around it yet and it does not add to the line
of code count at all to have to do this; it's just not aesthetic to me.

If this idea is okay, I can make all the similar changes
in the Mips Subzero port.

BUG=

Review URL: https://codereview.chromium.org/1661233002 .

Patch from Reed Kotler <rkotlerimgtec@gmail.com>.

8 years agoSubzero. ARM32. Refactors atomic intrinsics lowering.
John Porto [Wed, 17 Feb 2016 13:00:59 +0000 (05:00 -0800)]
Subzero. ARM32. Refactors atomic intrinsics lowering.

BUG=  https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1409863006 .

8 years agoSubzero: Set the correct target arch in the browser hookup.
Jim Stichnoth [Tue, 16 Feb 2016 13:47:32 +0000 (05:47 -0800)]
Subzero: Set the correct target arch in the browser hookup.

The original implementation hard-coded the target to x86-32.

The new implementation mirrors pnacl-llc by probing the architecture it is running on.

Continues the plumbing work in https://codereview.chromium.org/1698523003/ , toward the goal of enabling sandboxed translator tests for x86-64, particularly on the spec bots.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4077
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1696123003 .

8 years agoSubzero: Avoid explicit references to RegNumT sentinel value.
Reed Kotler [Tue, 16 Feb 2016 04:01:24 +0000 (20:01 -0800)]
Subzero: Avoid explicit references to RegNumT sentinel value.

There are many occurrences of if (RegNum == RegNumT::NoRegister).

This patch eliminates NoRegister and provides a simpler mechanism for declaring and testing RegNumT values to see if they are undefined.

BUG= none
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1691193002 .

Patch from Reed Kotler <rkotlerimgtec@gmail.com>.

8 years agoAdd move vector to the integrated ARM assembler.
Karl Schimpf [Thu, 11 Feb 2016 23:20:49 +0000 (15:20 -0800)]
Add move vector to the integrated ARM assembler.

Implements a vector move as a vector orr on the corresponding Q
registers.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=eholk@chromium.org

Review URL: https://codereview.chromium.org/1694533002 .

8 years agoSubzero. ARM32. Nonsfi.
John Porto [Wed, 10 Feb 2016 23:57:16 +0000 (15:57 -0800)]
Subzero. ARM32. Nonsfi.

Adds nonsfi support to the ARM32 backend.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1665263003 .

8 years agoFix missing register class.
Karl Schimpf [Wed, 10 Feb 2016 21:38:10 +0000 (13:38 -0800)]
Fix missing register class.

Adds class name for the "QtoS" register class.

BUG=None
R=eholk@chromium.org

Review URL: https://codereview.chromium.org/1687163002 .

8 years agoAdd insert/extract element to the integrated ARM assembler.
Karl Schimpf [Wed, 10 Feb 2016 21:30:48 +0000 (13:30 -0800)]
Add insert/extract element to the integrated ARM assembler.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1679023008 .

8 years agoARM32 vector ops - scalarize icmp, fcmp and cast.
Eric Holk [Wed, 10 Feb 2016 21:07:06 +0000 (13:07 -0800)]
ARM32 vector ops - scalarize icmp, fcmp and cast.

This is part of a sequence of patches to quickly fill out vector
support by scalarizing the remaining operations. Later we can work to
generate better code.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1683153003 .

8 years agoSubzero: Use a proper RegNumT type instead of int32_t/SizeT.
Jim Stichnoth [Wed, 10 Feb 2016 19:20:30 +0000 (11:20 -0800)]
Subzero: Use a proper RegNumT type instead of int32_t/SizeT.

Originally, register numbers were represented explicitly as int32_t, particularly so that -1 (or negative values in general) could be used as a NoRegister sentinel value.  This created two problems:

1. It would be better to use a unique name for the type, to distinguish from other explicit int32_t uses such as stack offsets.

2. Apart from NoRegister, register number values ultimately come from unsigned sources like enum values and bitvector positions.  This results in a number of clumsy casts to remove compiler warnings.

This creates a simple RegNumT class to manage this.  It also deletes ordered comparison operators to help catch errors where particular register number orderings are assumed (as opposed to orderings of the encoded register values).

In addition, it creates a RegNumBitVector wrapper class that makes it much cleaner to do range-based for loops over bit vectors that represent RegNumT sets.

BUG= none
R=eholk@chromium.org, jpp@chromium.org

Review URL: https://codereview.chromium.org/1676123002 .

8 years agoFix bug in arith.ll (ARM) tests.
Karl Schimpf [Wed, 10 Feb 2016 18:30:46 +0000 (10:30 -0800)]
Fix bug in arith.ll (ARM) tests.

CL https://codereview.chromium.org/1687553002 introduced a bug when
running:

   make -f Makefile.standalone check-lit FORCEASM=1

The cause of the problem is the way options "--asemble --disassemble"
work in run-pnacl-sz.py. When compiling using "--filetype=asm", the
assembler writes:

   .word 0xe7fedef0

The output after assembly/disassembly is the same as above.

On the other hand, when compiling using "--filetype=iasm", the assembler
writes:

   .byte 0xe7
   .byte 0xfe
   .byte 0xde
   .byte 0xf0

While the same sequence of bytes is assembled, the dissassembly for the
latter generates assembly instruction:

    udf #60896 ; 0xede0

The fix is to not check the generated disassembled instructions. Rather,
have it check if the same word is associated with the assembly
instruction.

Longer term, we should fix the several different ways --filetype=asm
introduces this instruction to match the "udf ..." output.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1682253003 .

8 years agoARM32 vector division lowering.
Eric Holk [Wed, 10 Feb 2016 01:47:58 +0000 (17:47 -0800)]
ARM32 vector division lowering.

Enables vector division by scalarization.

Also, removed an assert as suggested by Karl in a previous CL:
https://codereview.chromium.org/1646033002/diff/1/src/IceInstARM32.cpp#newcode717

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1681003002 .

8 years agoSubzero: Fix trailing whitespace errors.
Jim Stichnoth [Wed, 10 Feb 2016 01:25:02 +0000 (17:25 -0800)]
Subzero: Fix trailing whitespace errors.

To view the non-whitespace changes in this CL:

  git cl patch -b testbranch 1678133003
  git diff -w --ignore-blank-lines -b master

Such changes are only in gen_arm32_reg_tables.py and IceInst.cpp.

There are lots of tab characters in .ll files that shouldn't be there, but fixing them would require some thought about how to do consistent formatting, so that's left for later.

BUG= none
R=eholk@chromium.org, kschimpf@google.com

Review URL: https://codereview.chromium.org/1678133003 .

8 years agoChange ARM calls into indirect calls.
Karl Schimpf [Tue, 9 Feb 2016 21:20:38 +0000 (13:20 -0800)]
Change ARM calls into indirect calls.

This is done by putting far pointers (for calls) into a
register and then do an indirect call.

This was done to guarantee that we aren't putting a size limit on ARM32 executables.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1687553002 .

8 years agoAdd NOP to ARM IR lowering.
Karl Schimpf [Tue, 9 Feb 2016 21:09:23 +0000 (13:09 -0800)]
Add NOP to ARM IR lowering.

This change allows pnacl-sz to randomly insert NOPs into the generated
code, as is already done with X86.

BUG=None
R=eholk@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1670413002 .

8 years agoFix ARM assembler to pop registers in reverse order of pushes.
Karl Schimpf [Tue, 9 Feb 2016 20:23:55 +0000 (12:23 -0800)]
Fix ARM assembler to pop registers in reverse order of pushes.

BUG=None
R=jpp@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1669973002 .

8 years agoSubzero: ARM32: lowering of vector insert and extract.
Eric Holk [Mon, 8 Feb 2016 23:22:18 +0000 (15:22 -0800)]
Subzero: ARM32: lowering of vector insert and extract.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1655313002 .

8 years agoSubzero: Clean up some uses of *_cast<>.
Jim Stichnoth [Sun, 7 Feb 2016 17:50:27 +0000 (09:50 -0800)]
Subzero: Clean up some uses of *_cast<>.

Some casts to size_t for use as array indexes are simply unnecessary.

Some explicit declaration types are changed to "auto" to avoid redundancy with the static_cast type.

A few llvm::dyn_cast<> operations are changed to llvm::cast<>, and vice versa.

A few explicit declaration types are changed to "auto" when used with llvm::cast<> and llvm::dynamic_cast<>.  Some of these were missed during an earlier cleansing because of multi-line issues.

There are still a few opportunities related to Variable register numbers, but they are ignored for now because they are being addressed in another CL.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1674033002 .

8 years agoSubzero: Fix a mul lowering error.
Jim Stichnoth [Fri, 5 Feb 2016 23:43:24 +0000 (15:43 -0800)]
Subzero: Fix a mul lowering error.

The low-level mul instruction may produce results in a register pair where one register is the explicit dest of the instruction, and the other register is defined through a FakeDef.  If the FakeDef portion is ultimately unused, the FakeDef gets dead-code eliminated, and the register allocator doesn't know that the mul instruction affects the other register.

On x86, this can silently produce incorrect code.  On ARM, the emitter complains that the explicitly represented second dest variable does not have a register.

The fix is to add a FakeUse of the FakeDef'd register.  Unfortunately, this prevents the low-level mul instruction from ever being dead-code eliminated, but that's probably OK because it should have been eliminated at the high level.

BUG= none
R=eholk@chromium.org

Review URL: https://codereview.chromium.org/1678523002 .

8 years agoSubzero: Improve an error message.
Jim Stichnoth [Fri, 5 Feb 2016 18:26:09 +0000 (10:26 -0800)]
Subzero: Improve an error message.

Add the variable name and function name to the fatal error message.

BUG= none
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/1677593003 .

8 years agoSubzero: Cleanup Inst==>Instr.
Jim Stichnoth [Fri, 5 Feb 2016 17:50:02 +0000 (09:50 -0800)]
Subzero: Cleanup Inst==>Instr.

In the beginning, Ice::Inst was called IceInst, and patterns like "IceInst *Inst = ..." made perfect sense.

After the Ice:: name change, "Inst *Inst = ..." continued to compile, mostly.

However, shadowing a type name is clumsy and newer code tends to use "Inst *Instr", so we might as well switch all the instances over.

Some are still called "I" and those are left alone.

BUG= none
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/1665423002 .

8 years agoClean up assembling MOV instructions in the integrated ARM assembler.
Karl Schimpf [Fri, 5 Feb 2016 15:26:41 +0000 (07:26 -0800)]
Clean up assembling MOV instructions in the integrated ARM assembler.

Flattens out MOV's emitIAS methods making it easier to see valid types
for source/destination of the move.

BUG=None
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1665323002 .

8 years agoFix vector load/stores in the ARM assembler.
Karl Schimpf [Thu, 4 Feb 2016 21:54:53 +0000 (13:54 -0800)]
Fix vector load/stores in the ARM assembler.

Fixes emit() methods for load/store to specify the element size (affects
alignment issues).

Also adds assembler methods to generate the corresponding binary forms,
and updates emitIAS() to call these assembler methods.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1663053008 .

8 years agoSubzero. Uses fixups to calculate addend to relocations.
John Porto [Thu, 4 Feb 2016 18:35:20 +0000 (10:35 -0800)]
Subzero. Uses fixups to calculate addend to relocations.

This CL modifies the ELF emission so the addends are calculated during
object file creation, and not during function code emission.

BUG=
R=kschimpf@google.com, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1669443002 .

8 years agoSubzero. X86. Fixes bundle lock/unlock.
John Porto [Thu, 4 Feb 2016 17:12:02 +0000 (09:12 -0800)]
Subzero. X86. Fixes bundle lock/unlock.

The AutoMemorySandboxer does not have to emit a bundle lock/unlock pair
for memory operations in x8632, but the current does emit it. This CL
changes this behavior.

BUG=
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1661403002 .

8 years agoSubzero. Adds symbolic references to RelocInitializer.
John Porto [Thu, 4 Feb 2016 16:42:48 +0000 (08:42 -0800)]
Subzero. Adds symbolic references to RelocInitializer.

BUG=
R=kschimpf@google.com, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1661193004 .

8 years agoFollowing the newer convention enhances readability and in addition this is a prelude...
Reed Kotler [Wed, 3 Feb 2016 22:40:47 +0000 (14:40 -0800)]
Following the newer convention enhances readability and in addition this is a prelude to some macro changes in unimplemented I would like to make in order to simplify that code.

BUG=
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1667553002 .

Patch from Reed Kotler <rkotlerimgtec@gmail.com>.

8 years agoAdd VMUL vector instructions to the integrated ARM assembler.
Karl Schimpf [Wed, 3 Feb 2016 21:27:01 +0000 (13:27 -0800)]
Add VMUL vector instructions to the integrated ARM assembler.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1665593002 .

8 years agoAdd vector VEOR instruction to the integrated ARM assembler.
Karl Schimpf [Wed, 3 Feb 2016 21:21:50 +0000 (13:21 -0800)]
Add vector VEOR instruction to the integrated ARM assembler.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=eholk@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1655363002 .

8 years agoSubzero. Enables moar complex relocation offsets.
John Porto [Tue, 2 Feb 2016 23:06:09 +0000 (15:06 -0800)]
Subzero. Enables moar complex relocation offsets.

This CL allows ConstantRelocatables in to Subzero
have symbolic constants. A symbolic constant is an
assembly label whose value is not known during
lowering, but it is well defined during code
emission.

For example, the following code is now possible in Subzero:

foo:
  push $foo.bar
  jmp target
  nop
  nop
foo.bar:
  ...

BUG=
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1651163002 .

8 years agoFix nits from CL https://codereview.chromium.org/1661633002.
Karl Schimpf [Tue, 2 Feb 2016 21:54:55 +0000 (13:54 -0800)]
Fix nits from CL https://codereview.chromium.org/1661633002.

BUG=None
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1658423002 .

8 years agoAdd FABS intrinsic to the integrated ARM assembler.
Karl Schimpf [Tue, 2 Feb 2016 21:35:45 +0000 (13:35 -0800)]
Add FABS intrinsic to the integrated ARM assembler.

Adds the non-vector forms of fabs.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=eholk@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1657193003 .

8 years agoAdd VORR instruction to the integrated ARM assembler.
Karl Schimpf [Tue, 2 Feb 2016 20:57:30 +0000 (12:57 -0800)]
Add VORR instruction to the integrated ARM assembler.

Also simplify several switch statements by replacing type entries with
default.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334

Review URL: https://codereview.chromium.org/1661633002 .

8 years agoAdd VAND to the integrated ARM assembler.
Karl Schimpf [Tue, 2 Feb 2016 19:25:10 +0000 (11:25 -0800)]
Add VAND to the integrated ARM assembler.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=jpp@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1657353002 .

8 years agoAdd VSUB vector instruction to the integrated ARM assembler.
Karl Schimpf [Tue, 2 Feb 2016 18:19:20 +0000 (10:19 -0800)]
Add VSUB vector instruction to the integrated ARM assembler.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1651263002 .

8 years agoFix skip_unimplemented for filetype=obj in ARM.
Karl Schimpf [Tue, 2 Feb 2016 18:17:01 +0000 (10:17 -0800)]
Fix skip_unimplemented for filetype=obj in ARM.

Fixes generation of emit text fixup code in integrated ARM assembler to
properly reset the text fixup flag when skipping unimplemented
instructions.

Also fixes broken assertion for the "vmul" instruction.

BUG=None
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1656023002 .

8 years agoSubzero: Improve x86-32's implementation of getGprForType().
Jim Stichnoth [Tue, 2 Feb 2016 17:29:21 +0000 (09:29 -0800)]
Subzero: Improve x86-32's implementation of getGprForType().

Replaces the hacky implementation with essentially the less hacky x86-64 implementation, minus the i64 handling.

Also does a couple of cleanups on the x86-64 side, including removing special-casing for rbp.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1657833002 .

8 years agoSubzero: Mips: Lower some i64 arithmetic instructions.
Reed Kotler [Tue, 2 Feb 2016 04:52:19 +0000 (20:52 -0800)]
Subzero: Mips: Lower some i64 arithmetic instructions.

This patch is a MIPS version of this part of ARM patch:
https://codereview.chromium.org/1151663004/

BUG=
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1640913004 .

Patch from Reed Kotler <rkotlerimgtec@gmail.com>.

8 years agoImprove readability of error messages for VADD in ARM assembler.
Karl Schimpf [Mon, 1 Feb 2016 22:40:01 +0000 (14:40 -0800)]
Improve readability of error messages for VADD in ARM assembler.

Fixes readability of error messages, based on comment in CL:

   https://codereview.chromium.org/1652173002

BUG=None
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1654803003 .

8 years agoImplements the vector add instructions in the integrated ARM assembler.
Karl Schimpf [Mon, 1 Feb 2016 21:44:37 +0000 (13:44 -0800)]
Implements the vector add instructions in the integrated ARM assembler.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1652173002 .