OSDN Git Service

android-x86/external-swiftshader.git
7 years agoSubzero: Updated documentation to describe building spec2k benchmarks
Thomas Lively [Mon, 22 Aug 2016 17:05:30 +0000 (10:05 -0700)]
Subzero: Updated documentation to describe building spec2k benchmarks

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

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

Patch from Thomas Lively <tlively@google.com>.

7 years agoProvide repointEdges for MIPS.
Jaydeep Patil [Fri, 19 Aug 2016 05:43:43 +0000 (22:43 -0700)]
Provide repointEdges for MIPS.

R=stichnot@chromium.org

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

Patch from Jaydeep Patil <jaydeep.patil@imgtec.com>.

7 years ago[SubZero]Added InstMIPS32Load to differentiate stores from loads
Jaydeep Patil [Fri, 19 Aug 2016 05:37:30 +0000 (22:37 -0700)]
[SubZero]Added InstMIPS32Load to differentiate stores from loads

Both the operands in InstMIPS32Memory are source. However in load instructions, first operand is a destination. The InstMIPS32Load treats first operand as destination and second operand as source.

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

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

Patch from Jaydeep Patil <jaydeep.patil@imgtec.com>.

7 years agoSubzero: Added address of bad instruction to error output
Thomas Lively [Fri, 19 Aug 2016 00:47:34 +0000 (17:47 -0700)]
Subzero: Added address of bad instruction to error output

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

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

7 years agoSubzero: Replace pointers to allocation functions in stores
Thomas Lively [Thu, 18 Aug 2016 17:37:46 +0000 (10:37 -0700)]
Subzero: Replace pointers to allocation functions in stores

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

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

7 years agoSubzero: Include commit count in revision string.
Jim Stichnoth [Wed, 17 Aug 2016 23:20:21 +0000 (16:20 -0700)]
Subzero: Include commit count in revision string.

Instead of the version string being like this:
  Subzero_revision_efdf412032f7622a0663696896708d75b82e92f6
Make it more like this:
  Subzero_revision_1089_efdf412032f7622a0663696896708d75b82e92f6
I.e., provide both git hash and commit count.

That way, it's easier to compare revision strings and determine which one is newer.

BUG= none
R=eholk@chromium.org

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

7 years agoSubzero: Fix build errors with LLVM trunk.
Jim Stichnoth [Wed, 17 Aug 2016 16:12:52 +0000 (09:12 -0700)]
Subzero: Fix build errors with LLVM trunk.

1. Some explicit conversions between Inst* and InstList::iterator are needed.

2. llvm::sys::PrintStackTraceOnErrorSignal() has a new argument.

3. A previous CL neglected to plumb in SUBZERO_REVISION for the cmake build.

BUG= none
R=eholk@chromium.org

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

7 years agoSubzero: Replace pointers to allocation functions in loads
Thomas Lively [Tue, 16 Aug 2016 21:55:51 +0000 (14:55 -0700)]
Subzero: Replace pointers to allocation functions in loads

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

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

7 years agoSubzero: Replace global pointers to allocation functions
Thomas Lively [Tue, 16 Aug 2016 18:34:09 +0000 (11:34 -0700)]
Subzero: Replace global pointers to allocation functions

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

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

7 years agoSubZero: Add return registers for float/double types in lowerCall
Mohit Bhakkad [Sat, 13 Aug 2016 06:33:14 +0000 (23:33 -0700)]
SubZero: Add return registers for float/double types in lowerCall

R=stichnot@chromium.org

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

7 years agoSubzero: Elide redundant access checks within basic blocks
Thomas Lively [Thu, 11 Aug 2016 18:24:27 +0000 (11:24 -0700)]
Subzero: Elide redundant access checks within basic blocks

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

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

8 years agoSubzero: Added ASan quarantine for recently freed objects
Thomas Lively [Wed, 10 Aug 2016 17:36:24 +0000 (10:36 -0700)]
Subzero: Added ASan quarantine for recently freed objects

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

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

8 years agoSubzero: Implemented codegen for poisoning and unpoisoning stack redzones
Thomas Lively [Tue, 9 Aug 2016 22:02:35 +0000 (15:02 -0700)]
Subzero: Implemented codegen for poisoning and unpoisoning stack redzones

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

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

8 years agoSubzero: More documentation for the NACLENV arg passthrough mechanism.
Jim Stichnoth [Mon, 8 Aug 2016 21:25:51 +0000 (14:25 -0700)]
Subzero: More documentation for the NACLENV arg passthrough mechanism.

BUG= none

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

8 years agoSubzero: Embed the revision string into translated output.
Jim Stichnoth [Mon, 8 Aug 2016 21:15:00 +0000 (14:15 -0700)]
Subzero: Embed the revision string into translated output.

Modify the Makefiles to pass in the current git hash, which is embedded into the translated output.  As a side effect, it is also embedded into the Subzero translator binary.  This is useful for two reasons:

1. The PNaCl component update process is somewhat manual, making it tricky long after the fact to know exactly which revision was pushed, e.g. when trying to reproduce a bug or crash.

2. A translated binary can be inspected to make sure Chrome used the expected revision of Subzero.  (And also to verify that pnacl-sz was used rather than pnacl-llc.)

The revision string is suppressed for lit tests, because a number of tests seem overly strict about global initializer expectations.

BUG= none
R=jpp@chromium.org

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

8 years agoSubzero: Use Cfg::getOptLevel() instead of ClFlags version.
Jim Stichnoth [Fri, 5 Aug 2016 22:18:41 +0000 (15:18 -0700)]
Subzero: Use Cfg::getOptLevel() instead of ClFlags version.

The opt level (O2 versus Om1) should be tested using Cfg::getOptLevel() instead of getFlags().getOptLevel() whenever possible.

This is because if you run "-Om1 -force-O2=foo", and you're compiling foo, the first form tells you O2 while the second form tells you Om1.

BUG= none
R=eholk@chromium.org

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

8 years agoSubzero: Use the memset inline threshold for memset.
Jim Stichnoth [Fri, 5 Aug 2016 21:11:49 +0000 (14:11 -0700)]
Subzero: Use the memset inline threshold for memset.

Memset lowering was using the memcpy inline threshold instead of the memset threshold.

Using the memset threshold as specified (16) seems to make spec2k performance slightly worse, so change it to the original value (8).

BUG= none
R=eholk@chromium.org

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

8 years agoDocumentation for LCSE, LICM, Short-Circuit, Global-Splitting
Manasij Mukherjee [Fri, 5 Aug 2016 19:29:56 +0000 (12:29 -0700)]
Documentation for LCSE, LICM, Short-Circuit, Global-Splitting

LCSE is local common sub-expression elimination.
LICM is loop invariant code motion.
Short circuit splits basic blocks and introduces early jumps.
Global Splitting is a post regalloc live range splitting pass.

BUG=none
R=stichnot@chromium.org

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

8 years agoAggressive LEA
Manasij Mukherjee [Thu, 4 Aug 2016 21:28:37 +0000 (14:28 -0700)]
Aggressive LEA

Convert adds with a constant operand to lea on -aggressive-lea

BUG=none
R=stichnot@chromium.org

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

8 years agoFloat Constant CSE
Manasij Mukherjee [Thu, 4 Aug 2016 21:24:58 +0000 (14:24 -0700)]
Float Constant CSE

Load multiple uses of a floating point constant (between two call
instructions or block start/end) into a variable before its first use.
  t1 = b + 1.0
  t2 = c + 1.0
Gets transformed to:
  t0 = 1.0
  t0_1 = t0
  t1 = b + t0_1
  t2 = c + t0_1
Call instructions reset the procedure, but uses the same variable, just
in case it got a register. We are assuming floating point registers are
not calee saved in general. Example, continuing from before:
  result = call <some function>
  t3 = d + 1.0
Gets transformed to:
  result = call <some function>
  t0_2 = t0
  t3 = d + t0_2

BUG= none
R=stichnot@chromium.org

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

8 years agoLive Range Splitting after initial Register Allocation
Manasij Mukherjee [Thu, 4 Aug 2016 19:33:23 +0000 (12:33 -0700)]
Live Range Splitting after initial Register Allocation

After register allocation is done once, this pass targets
the variables that do not get registers, break them into
multiple variables with shorter (at most spanning a basic
block) live ranges. After discarding the new variables with
too few uses, the register allocator is run again and
the new variables that manage to get registers are inserted.

BUG=None
R=stichnot@chromium.org

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

8 years agoSubzero: Improved quality of ASan error messages
Thomas Lively [Thu, 4 Aug 2016 18:35:07 +0000 (11:35 -0700)]
Subzero: Improved quality of ASan error messages

Added load/store and stack/heap/global information.

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

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

8 years agoSubzero: Fix sign issues for inlined memset lowering.
Jim Stichnoth [Thu, 4 Aug 2016 14:02:49 +0000 (07:02 -0700)]
Subzero: Fix sign issues for inlined memset lowering.

For certain cases of inlined memset lowering, the 8-bit value wasn't being properly spread/replicated into the 32-bit immediate to be stored.

Specifically, if the 8-bit value is between -128 and -1 (i.e. 0x80 to 0xff), the spread value would be something like 0xffffff80 instead of 0x80808080.

BUG= b/30502279
R=jpp@chromium.org

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

8 years agoSubzero: Fix formatting.
Jim Stichnoth [Thu, 4 Aug 2016 01:26:24 +0000 (18:26 -0700)]
Subzero: Fix formatting.

Previous CL forgot to "make format".

BUG= none

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

8 years agoSubzero: removed loops from ASan access checking
Thomas Lively [Wed, 3 Aug 2016 18:15:41 +0000 (11:15 -0700)]
Subzero: removed loops from ASan access checking

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

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

8 years agoSubZero: Adding support for all Reg pairs in getI64PairFirst/SecondGPRNum
Mohit Bhakkad [Tue, 2 Aug 2016 12:55:11 +0000 (05:55 -0700)]
SubZero: Adding support for all Reg pairs in getI64PairFirst/SecondGPRNum

R=stichnot@chromium.org

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

8 years agoEnable Local CSE by default
Manasij Mukherjee [Mon, 1 Aug 2016 22:40:42 +0000 (15:40 -0700)]
Enable Local CSE by default

Reduce the default number of iterations to 1
Put the optional code behind the -lcse-no-ssa flag, which is disabled by
default. This brings down the overhead of enabling this to about 2%.

BUG=
R=stichnot@chromium.org

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

8 years agoSubzero: Local variable splitting.
Jim Stichnoth [Mon, 1 Aug 2016 20:18:36 +0000 (13:18 -0700)]
Subzero: Local variable splitting.

The linear-scan register allocator takes an all-or-nothing approach -- either the variable's entire live range gets a register, or none of it does.

To help with this, we add a pass that splits successive uses of a variable within a basic block into a chain of linked variables.  This gives the register allocator the chance to allocate registers to subsets of the original live range.

The split variables are linked to each other so that if they don't get a register, they share a stack slot with the original variable, and redundant writes to that stack slot are recognized and elided.

This pass is executed after target lowering and right before register allocation.  As such, it has to deal with some idiosyncrasies of target lowering, specifically the possibility of intra-block control flow.  We experimented with doing this as a pre-lowering pass.  However, the transformations interfered with some of the target lowering's pattern matching, such as bool folding, so we concluded that post-lowering was a better place for it.

Note: Some of the lit tests are overly specific about registers, and in these cases it was the path of least resistance to just disable local variable splitting.

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

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

8 years agoSubzero: Removed unnecessary global access checks
Thomas Lively [Wed, 27 Jul 2016 22:55:42 +0000 (15:55 -0700)]
Subzero: Removed unnecessary global access checks

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

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

8 years agoSubzero: Elide checks of known valid accesses of locals
Thomas Lively [Tue, 26 Jul 2016 18:47:40 +0000 (11:47 -0700)]
Subzero: Elide checks of known valid accesses of locals

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

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

8 years agoBisection debugging helper script
Manasij Mukherjee [Mon, 25 Jul 2016 19:34:54 +0000 (12:34 -0700)]
Bisection debugging helper script

BUG=none
R=stichnot@chromium.org

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

8 years agoSubzero: small cleanups
Thomas Lively [Thu, 21 Jul 2016 21:13:03 +0000 (14:13 -0700)]
Subzero: small cleanups

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

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

8 years agoSelectively invert ICMP operands for better address optimization
Manasij Mukherjee [Thu, 21 Jul 2016 19:40:24 +0000 (12:40 -0700)]
Selectively invert ICMP operands for better address optimization

Results in lower code size and more loads folded into cmp instructions.

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

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

8 years ago[Subzero][MIPS32] Fix stack offset assignment of spilled variables on MIPS32
Sagar Thakur [Thu, 21 Jul 2016 13:12:09 +0000 (06:12 -0700)]
[Subzero][MIPS32] Fix stack offset assignment of spilled variables on MIPS32

BUG=none
R=stichnot@chromium.org

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

Patch from Sagar Thakur <sagar.thakur@imgtec.com>.

8 years agoSubzero: Instrumented realloc
Thomas Lively [Thu, 21 Jul 2016 06:30:45 +0000 (23:30 -0700)]
Subzero: Instrumented realloc

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

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

8 years agoSubzero: Fixed deadlock when _start is first function
Thomas Lively [Wed, 20 Jul 2016 18:19:17 +0000 (11:19 -0700)]
Subzero: Fixed deadlock when _start is first function

It was previously the case that instrumentStart in ASanInstrumentation would block until instrumentGlobals had completed. This was because instrumentStart depends on the global redzones having been inserted. However, instrumentGlobals was not called until the first function was popped off the emit queue, and when _start was the first function, it was not placed on the emit queue until after it had been instrumented and lowered. instrumentStart was waiting for instrumentGlobals, which could not happen until instrumentStart completed.

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

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

8 years agoImprove LoopAnalyzer Interface
Manasij Mukherjee [Tue, 19 Jul 2016 20:31:36 +0000 (13:31 -0700)]
Improve LoopAnalyzer Interface

Make LoopAnalyzer compute loop bodies and depth only.
Move the logic for finding out loop headers and pre-headers to LoopInfo, which provides a visitor to iterate over the loops and easy access to the information.
This does not change the core algorithm.

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

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

8 years agoSubzero: Fix lowering for x86 div/rem instructions.
Jim Stichnoth [Tue, 19 Jul 2016 13:35:52 +0000 (06:35 -0700)]
Subzero: Fix lowering for x86 div/rem instructions.

The x86 lowering sequences for sdiv/udiv/srem/urem all have a problem, in that they don't reflect the fact that two registers are affected by the instruction.

For example, the urem instruction:
  dest = src0 urem src1
lowers to something like this:
  t1:eax = src0
  t2:edx = 0
  t2:edx = (t1:eax and t2:edx) div src1
  dest = t2:edx

The problem is that there is no indication that the div instruction smashes eax.  As such, it's possible that the register allocator could erroneously assume that src0 is still available in eax after the div instruction.

To fix this, we make use of the FakeDef instruction.  In this example, we change the div instruction to "officially" produce eax as its result, then fakedef edx in terms of eax.  This means that as long as the urem result is actually used, the definitions of eax and edx will be preserved, but if the urem result is unused, then the whole sequence can be dead-code eliminated.

  t1:eax = src0
  t2:edx = 0
  t1:eax = (t1:eax and t2:edx) div src1  # dest var changed to t1:eax
  t2:edx = fakedef t1:eax                # fakedef instruction added
  dest = t2:edx

BUG= none
R=jpp@chromium.org

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

8 years ago[Subzero][MIPS32] Implement post lower legalizer for MIPS32
Sagar Thakur [Thu, 14 Jul 2016 21:50:37 +0000 (14:50 -0700)]
[Subzero][MIPS32] Implement post lower legalizer for MIPS32

BUG=none
R=stichnot@chromium.org

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

Patch from Sagar Thakur <sagar.thakur@imgtec.com>.

8 years agoimplemented wrapper script to replace calls to calloc()
Thomas Lively [Thu, 14 Jul 2016 21:29:59 +0000 (14:29 -0700)]
implemented wrapper script to replace calls to calloc()

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

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

8 years agoUpdates in preparation of wrapper script
Thomas Lively [Wed, 13 Jul 2016 21:43:53 +0000 (14:43 -0700)]
Updates in preparation of wrapper script

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

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

8 years agoSubZero: Correct parenthesis for mem operands with labels in MIPS32
Mohit Bhakkad [Wed, 13 Jul 2016 14:32:37 +0000 (07:32 -0700)]
SubZero: Correct parenthesis for mem operands with labels in MIPS32

R=stichnot@chromium.org

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

8 years agoLoop Invariant Code Motion
Manasij Mukherjee [Tue, 12 Jul 2016 23:59:17 +0000 (16:59 -0700)]
Loop Invariant Code Motion

Implemented behind the new -licm flag.
Hoists invariant arithmetic instructions from loop bodies to pre-headers.
Does not trigger for loops where headers have two incoming edges from
outside the loop.
Also enables multi block address optimization, because most of the
instructions hoisted are address calculations coming from gep.

Does not touch memory operations.
This algorithm does not seem to work well for load-hoisting.

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

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

8 years ago[Subzero][MIPS32] Implements variable alloca for MIPS32
Sagar Thakur [Tue, 12 Jul 2016 11:06:44 +0000 (04:06 -0700)]
[Subzero][MIPS32] Implements variable alloca for MIPS32

BUG=none
R=stichnot@chromium.org

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

Patch from Sagar Thakur <sagar.thakur@imgtec.com>.

8 years agoSubzero, MIPS32: Handling floating point instructions fadd, fsub, fmul, fdiv
Srdjan Obucina [Tue, 12 Jul 2016 03:23:50 +0000 (20:23 -0700)]
Subzero, MIPS32: Handling floating point instructions fadd, fsub, fmul, fdiv

This patch adds handling of floating point instructions
fadd, fsub, fmul and fdiv. Regarding frem, Mips32 does not have
instruction that calculates partial reminder, so it has to be
emulated with a set of instructions. Emulating frem will be addressed
in separate patch, when floating point format conversion instructions
are fully implemented.

BUG=
R=stichnot@chromium.org

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

Patch from Srdjan Obucina <Srdjan.Obucina@imgtec.com>.

8 years agoSubzero: Allow deeper levels of variable splitting.
Jim Stichnoth [Sun, 10 Jul 2016 12:13:18 +0000 (05:13 -0700)]
Subzero: Allow deeper levels of variable splitting.

This fixes some existing problems with the Variable::LinkedTo splitting/linking mechanism.  The problem was that if B is linked to A, and B needs a stack slot, but A doesn't get a stack slot, B's stack offset would never get initialized.  This could happen if A ends up with no explicit references in the code, or A's live range gets truncated such that it actually has a register while B doesn't.

It gets even more complicated if you have a link chain like A<--B<--C<--D etc. where some of them have stack slots (which should ultimately all be the same slot) and some don't.

The solution here is that if B is linked to the root A, and B has a stack slot but A doesn't, we can do a tree rotation so that B is the new root and A links to B.

In addition, we initialize Variable::StackOffset to an invalid value and always make sure a value used is valid.  Earlier attempts at extending the variable splitting would sometimes silently fail because the default StackOffset value of 0 ended up being used.

BUG= none
R=jpp@chromium.org

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

8 years agoBlacklisted instrumenting _Balloc.
Thomas Lively [Thu, 7 Jul 2016 21:56:21 +0000 (14:56 -0700)]
Blacklisted instrumenting _Balloc.

Increases number of spec2k tests that run successfully with ASan from 2 to 6.

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

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

8 years agoSubZero: legalize for f32/f64 constants in MIPS32
Mohit Bhakkad [Thu, 7 Jul 2016 12:07:35 +0000 (05:07 -0700)]
SubZero: legalize for f32/f64 constants in MIPS32

R=stichnot@chromium.org

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

8 years agoSubzero, MIPS32: Extend InstMIPS32Mov to support different data types
Srdjan Obucina [Wed, 6 Jul 2016 22:58:07 +0000 (15:58 -0700)]
Subzero, MIPS32: Extend InstMIPS32Mov to support different data types

This patch extends InstMIPS32Mov instruction to support different datatypes, and emit proper low level instruction depending on operands properties and data types.

R=stichnot@chromium.org

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

Patch from Srdjan Obucina <Srdjan.Obucina@imgtec.com>.

8 years agoFixed instruction corruption bug for multiple returns.
Thomas Lively [Wed, 6 Jul 2016 20:46:12 +0000 (13:46 -0700)]
Fixed instruction corruption bug for multiple returns.

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

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

8 years agoImplemented loose checking for potential widened loads
Thomas Lively [Wed, 6 Jul 2016 17:02:45 +0000 (10:02 -0700)]
Implemented loose checking for potential widened loads

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

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

8 years agoImplemented aligning and poisoning global redzones
Thomas Lively [Thu, 30 Jun 2016 18:06:12 +0000 (11:06 -0700)]
Implemented aligning and poisoning global redzones

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

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

8 years agoSubzero: Fix Calling Convention for MIPS O32 abi
Mohit Bhakkad [Wed, 29 Jun 2016 13:51:08 +0000 (06:51 -0700)]
Subzero: Fix Calling Convention for MIPS O32 abi

We should take care of alignment while discarding GPR registers, I have written larger explanation in a comment.

R=stichnot@chromium.org

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

8 years agoAdded tests for bug detection on locals
Thomas Lively [Wed, 29 Jun 2016 05:16:05 +0000 (22:16 -0700)]
Added tests for bug detection on locals

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

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

8 years agoSubzero: Merge SpillVariable functionality directly into Variable.
Jim Stichnoth [Wed, 29 Jun 2016 04:40:33 +0000 (21:40 -0700)]
Subzero: Merge SpillVariable functionality directly into Variable.

Specifically, this is the ability to link variable B to variable A, such that if neither A nor B get a register assignment, they share a stack slot.

This CL just refactors and keeps basically the same functionality, in preparation for new work on variable splitting.

BUG= none
R=jpp@chromium.org

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

8 years agoShort Circuit Evaluation
Manasij Mukherjee [Mon, 27 Jun 2016 23:12:37 +0000 (16:12 -0700)]
Short Circuit Evaluation

Split Nodes whenever an early jump is possible by short circuiting boolean
operations. Nodes are split after conservatively checking for side effects,
which include definition of multi block variables, function calls and
instructions involving memory.

BUG=None
R=stichnot@chromium.org

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

8 years agoSubzero: Fix a potential null-pointer dereference.
Jim Stichnoth [Mon, 27 Jun 2016 23:11:03 +0000 (16:11 -0700)]
Subzero: Fix a potential null-pointer dereference.

BUG= none
R=jpp@chromium.org, manasijm@google.com

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

8 years agoReorder X8664 Register Defs so that scratch registers are allocated first
Manasij Mukherjee [Mon, 27 Jun 2016 22:42:12 +0000 (15:42 -0700)]
Reorder X8664 Register Defs so that scratch registers are allocated first

Reduces register pressure and the number of push/pops slightly.

BUG=none
R=stichnot@chromium.org

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

8 years agoInstrumented local variables and implemented runtime.
Thomas Lively [Mon, 27 Jun 2016 21:47:21 +0000 (14:47 -0700)]
Instrumented local variables and implemented runtime.

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

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

8 years agoTreat ORs as ADDs for address optimization if operand has enough zero bits on the...
Manasij Mukherjee [Mon, 27 Jun 2016 20:47:38 +0000 (13:47 -0700)]
Treat ORs as ADDs for address optimization if operand has enough zero bits on the right

  Index=Var Or Const to Index=Var + Const
  when Var = Var' << N and log2(Const) <= N
  or when Var = (2^M) * (2^N) and log2(Const) <= (M+N)
BUG=none
R=stichnot@chromium.org

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

8 years agoSubzero: Make -translate-only work with nonzero -threads=<N>.
Jim Stichnoth [Mon, 27 Jun 2016 14:30:56 +0000 (07:30 -0700)]
Subzero: Make -translate-only work with nonzero -threads=<N>.

When we skip translating an item due to the -translate-only option, we still need to add a dummy item to the work queue with the proper sequence number, otherwise the emitter thread waits endlessly for the next sequence number and never emits the rest of the items.

BUG= none
R=jpp@chromium.org

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

8 years agoSubzero: Make -asm-verbose local var offsets local.
Jim Stichnoth [Sat, 25 Jun 2016 17:14:39 +0000 (10:14 -0700)]
Subzero: Make -asm-verbose local var offsets local.

When running with -asm-verbose, assembler directives like the following are generated:

  lv$__123 = 16

These symbols show up in "nm" output of the .o file, and cause inconsistencies in symbol numbering between filetype=asm and filetype=obj, when doing szbuild.py bisection debugging.

The fix is to prepend ".L" to the symbol name, so that the assembler treats it as local.  E.g.:

  .L$lv$__123 = 16

BUG= none
R=eholk@chromium.org

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

8 years agoSubzero: Fix x86-64 memory sandboxing.
Jim Stichnoth [Sat, 25 Jun 2016 17:01:24 +0000 (10:01 -0700)]
Subzero: Fix x86-64 memory sandboxing.

Commit 2e4b960 (https://codereview.chromium.org/2084793002), which made address mode inference more aggressive, exposed a long-standing bug in memory sandboxing, which now manifests in 164.gzip.

The problem is in sandboxed code like this:

  movl %eax, %eax
  movb 64(%rsp,%rax), %cl

If %eax starts out -1, the mov address is something close to %rsp+4GB, instead of %rsp+63.

To fix this, we need to use an lea instruction in more cases - specifically when the sandboxed address has an index register and the non-symbolic portion of the offset is nonzero.

BUG= none
R=jpp@chromium.org

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

8 years ago[Subzero][MIPS32] Implements addEpilog for MIPS32
Sagar Thakur [Sat, 25 Jun 2016 15:34:10 +0000 (08:34 -0700)]
[Subzero][MIPS32] Implements addEpilog for MIPS32

BUG=none
R=stichnot@chromium.org

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

Patch from Sagar Thakur <sagar.thakur@imgtec.com>.

8 years agoSubzero, MIPS32: Fix FP register table
Srdjan Obucina [Sat, 25 Jun 2016 15:19:11 +0000 (08:19 -0700)]
Subzero, MIPS32: Fix FP register table

FP register table did not contain correct register information.

R=stichnot@chromium.org

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

Patch from Srdjan Obucina <Srdjan.Obucina@imgtec.com>.

8 years agoSubzero: Fix Makefile.standalone to enable format with DEBUG flag
Srdjan Obucina [Wed, 22 Jun 2016 16:04:07 +0000 (09:04 -0700)]
Subzero: Fix Makefile.standalone to enable format with DEBUG flag

When building pnacl with --host-flavor=debug, tools at

../../out/llvm_x86_64_linux_work/Release+Asserts/bin

are not available, so we need a fix to enable source code formatting
with tools from

../../out/llvm_x86_64_linux_debug_work/Debug+Asserts/bin

R=stichnot@chromium.org

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

Patch from Srdjan Obucina <Srdjan.Obucina@imgtec.com>.

8 years agoSubzero, MIPS32: UnimplementedError removed from most common crashers
Srdjan Obucina [Wed, 22 Jun 2016 15:57:02 +0000 (08:57 -0700)]
Subzero, MIPS32: UnimplementedError removed from most common crashers

UnimplementedError is removed from three functions because it causes
crashes in almost every test from tests_lit/llvm2ice_tests.

emitVariable appears as correct, UnimplementedError may be there by mistake.

lowerConstants is unimplemented, but its obvious without UnimeplementedError.

lowerJumpTables is unimplemented, but its obvious without UnimeplementedError.

We comment these three anyway while changing and testing, so removing them will
not affect final results anyway.

R=stichnot@chromium.org

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

Patch from Srdjan Obucina <Srdjan.Obucina@imgtec.com>.

8 years agoSubzero[MIPS32]: Make liveness validation errors easier to interpret
Mohit Bhakkad [Wed, 22 Jun 2016 12:47:29 +0000 (05:47 -0700)]
Subzero[MIPS32]: Make liveness validation errors easier to interpret

This patch repeats the same changes for MIPS32, which are done in https://codereview.chromium.org/2080633004 for ARM and X86 archs.

R=stichnot@chromium.org

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

8 years agoLowerCall for MIPS32
Mohit Bhakkad [Wed, 22 Jun 2016 12:44:05 +0000 (05:44 -0700)]
LowerCall for MIPS32

Lower call instructions for MIPS32.

R=stichnot@chromium.org

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

8 years agoCatch addition patterns for Index in Address Optimization
Manasij Mukherjee [Tue, 21 Jun 2016 21:22:43 +0000 (14:22 -0700)]
Catch addition patterns for Index in Address Optimization

  Index is Index=Var+Const ==>
    set Index=Var, Offset+=(Const<<Shift)
  Index is Index=Const+Var ==>
    set Index=Var, Offset+=(Const<<Shift)
  Index is Index=Var-Const ==>
    set Index=Var, Offset-=(Const<<Shift)
BUG=none
R=stichnot@chromium.org

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

8 years agoInserted local redzones.
Thomas Lively [Tue, 21 Jun 2016 18:43:07 +0000 (11:43 -0700)]
Inserted local redzones.

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

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

8 years agoSubzero: Make liveness validation errors easier to interpret.
Jim Stichnoth [Tue, 21 Jun 2016 18:22:17 +0000 (11:22 -0700)]
Subzero: Make liveness validation errors easier to interpret.

A portion of the translation workflow goes like this:

  dump #1
  renumber instructions
  liveness + live range construction
  validateLiveness (exit on failure)
  dump #2

If there are liveness validation errors, instruction numbers are reported with respect to the new instruction numbers, yet the most recent dump output is with respect to the old instruction numbers.  Confusion ensues.

To fix this, we just do dump #2 before validateLiveness.

BUG= none
R=jpp@chromium.org

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

8 years agoSubzero: Fix frame size for floating-point register out-args.
Jim Stichnoth [Mon, 20 Jun 2016 13:46:07 +0000 (06:46 -0700)]
Subzero: Fix frame size for floating-point register out-args.

The code that calculates maximum out-arg stack space was neglecting the fact that on x86-64, the first N scalar floating-point arguments are passed through xmm registers, not the stack.  As a result, stack frames were sometimes larger than necessary.

BUG= none
R=jpp@chromium.org

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

8 years agoSubzero: Improve lowering of rematerializable call args.
Jim Stichnoth [Mon, 20 Jun 2016 13:44:07 +0000 (06:44 -0700)]
Subzero: Improve lowering of rematerializable call args.

Normally, if a call argument is a rematerializable Variable, it is rematerialized into a GPR (via the "lea" instruction) and then written into the appropriate arg space.

This is appropriate for arguments passed on the stack, but for register arguments, it forces an unnecessary copy through another register.

This CL allows that intermediate register copy to be removed.

The resulting code looks cleaner, but it is unlikely to have much effect on performance - there really aren't register pressure issues because lots of scratch registers are available right before the call (which kills all scratch registers).

BUG= none
R=jpp@chromium.org

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

8 years agoInstrumented malloc and free with dummy functions.
Thomas Lively [Fri, 17 Jun 2016 22:53:24 +0000 (15:53 -0700)]
Instrumented malloc and free with dummy functions.

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

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

8 years ago[Subzero][MIPS32] Implements lowering of alloca instruction
Sagar Thakur [Thu, 16 Jun 2016 22:30:24 +0000 (15:30 -0700)]
[Subzero][MIPS32] Implements lowering of alloca instruction

BUG=none
R=stichnot@chromium.org

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

Patch from Sagar Thakur <sagar.thakur@imgtec.com>.

8 years agoInstrumented load and store with dummy calls to __asan_check().
Thomas Lively [Thu, 16 Jun 2016 18:03:15 +0000 (11:03 -0700)]
Instrumented load and store with dummy calls to __asan_check().

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

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

8 years agoSubzero: Build a better bitcast.
Jim Stichnoth [Thu, 16 Jun 2016 17:02:48 +0000 (10:02 -0700)]
Subzero: Build a better bitcast.

The x86 lowering of bitcast between integers and floats forced the transfer through a stack slot (the original implementer *cough* *cough* wasn't aware of the movd instruction).  This requires excess instructions, but also a store to memory followed immediately by a load from that location is very slow.

This fixes the problem by using the movd instruction instead.

BUG= none
R=jpp@chromium.org

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

8 years agoImplemented linking to a dummy ASan runtime
Thomas Lively [Wed, 15 Jun 2016 17:00:21 +0000 (10:00 -0700)]
Implemented linking to a dummy ASan runtime

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

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

8 years agoSubzero: Design doc: Include regalloc in Om1 pass list.
Jim Stichnoth [Wed, 15 Jun 2016 14:37:50 +0000 (07:37 -0700)]
Subzero: Design doc: Include regalloc in Om1 pass list.

The Om1 recipe also includes register allocation (minimal mode).

BUG= none
R=kschimpf@google.com

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

8 years agoSubzero: Improve register availability peephole for function return values.
Jim Stichnoth [Wed, 15 Jun 2016 05:21:33 +0000 (22:21 -0700)]
Subzero: Improve register availability peephole for function return values.

Originally, a call instruction was lowered like this:

  // %result = call @foo(...)
  %t1:eax = call foo
  %result = %t1:eax

Because t1 is pre-colored, it is not available as a substitution if the following instruction uses %result as a source operand.

To improve this, we copy it through an intermediate temporary:

  // %result = call @foo(...)
  %t1:eax = call foo
  %t2 = %t1:eax
  %result = %t2

BUG= none
R=eholk@chromium.org

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

8 years agoFinished small fixups.
Thomas Lively [Tue, 14 Jun 2016 21:06:17 +0000 (14:06 -0700)]
Finished small fixups.

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

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

8 years agoSubzero: x86-64: Allow immediates in 64-bit instructions.
Jim Stichnoth [Tue, 14 Jun 2016 14:27:22 +0000 (07:27 -0700)]
Subzero: x86-64: Allow immediates in 64-bit instructions.

The original code legalized *all* i64 constants into a register move, creating unnecessary instructions and slightly higher register pressure in most cases.

Generally, immediates can be used in 64-bit instructions as long as the immediate can be represented as a sign-extended 32-bit value.

BUG= none
R=jpp@chromium.org

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

8 years agoImplemented global redzones.
Thomas Lively [Mon, 13 Jun 2016 18:23:29 +0000 (11:23 -0700)]
Implemented global redzones.

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

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

8 years agoChange LowerArgument in MIPS to use CallingConvention class
Mohit Bhakkad [Mon, 13 Jun 2016 13:06:35 +0000 (06:06 -0700)]
Change LowerArgument in MIPS to use CallingConvention class

R=stichnot@chromium.org

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

8 years ago[Subzero][MIPS32] Adds prolog instructions for MIPS32
Sagar Thakur [Mon, 13 Jun 2016 12:55:00 +0000 (05:55 -0700)]
[Subzero][MIPS32] Adds prolog instructions for MIPS32

BUG=none
R=stichnot@chromium.org

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

Patch from Sagar Thakur <sagar.thakur@imgtec.com>.

8 years agoThis patch provides calling convention class for MIPS with support of integer and...
Mohit Bhakkad [Mon, 13 Jun 2016 07:28:13 +0000 (00:28 -0700)]
This patch provides calling convention class for MIPS with support of integer and floating point types

R=stichnot@chromium.org

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

8 years agoSubzero: Improve effectiveness of local register availability peephole.
Jim Stichnoth [Fri, 10 Jun 2016 19:21:17 +0000 (12:21 -0700)]
Subzero: Improve effectiveness of local register availability peephole.

X86 only.  The register availability peephole optimization during lowering disallows available register substitution when the variable is pre-colored.  This is for good reasons (too complex to be discussed here).  However, that leaves some potential substitutions on the table.

Specifically, this happens a lot around register arguments to function calls, both at the call site and in the prolog.

The simplest solution seems to be to launder the pre-colored variable through a separate infinite-weight variable, as implemented in this CL through a combination of such copies and extra legalize() calls.

There are other situations where this technique can also work, which may be handled in a separate CL.

This CL also fixes a problem where the stack pointer adjustment in the prolog is subject to dead-code elimination if the function has no epilog.  This would only happen in asm-verbose mode, in the final liveness analysis pass prior to code emission.

BUG= none
R=eholk@chromium.org

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

8 years agoAdding float/double support in CopyToReg
Mohit Bhakkad [Thu, 9 Jun 2016 22:06:23 +0000 (15:06 -0700)]
Adding float/double support in CopyToReg

R=stichnot@chromium.org

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

8 years agoCreated Ice::Instrumentation base class and accompanying hooks.
Thomas Lively [Tue, 7 Jun 2016 20:54:59 +0000 (13:54 -0700)]
Created Ice::Instrumentation base class and accompanying hooks.

Also added a command line flag for AddressSanitizer

BUG=None
R=kschimpf@google.com

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

8 years agoSubzero, MIPS32: Floating point load/store and format conversion instructions
Srdjan Obucina [Thu, 2 Jun 2016 13:47:06 +0000 (06:47 -0700)]
Subzero, MIPS32: Floating point load/store and format conversion instructions

Introducing instructions for floating point format conversion.
These instructions are needed for full implementation of lowerCast
and missing floating point arithmetic instruction frem.

BUG=
R=stichnot@chromium.org

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

Patch from Srdjan Obucina <Srdjan.Obucina@imgtec.com>.

8 years ago[Subzero][MIPS32] Implement icmp operation for i8, i16 operands
Sagar Thakur [Wed, 1 Jun 2016 19:36:50 +0000 (12:36 -0700)]
[Subzero][MIPS32] Implement icmp operation for i8, i16 operands

BUG=none
R=jpp@chromium.org

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

Patch from Sagar Thakur <sagar.thakur@imgtec.com>.

8 years agoSubzero: Crosstest test_arith properly tests i8/i16.
Jim Stichnoth [Tue, 31 May 2016 19:21:51 +0000 (12:21 -0700)]
Subzero: Crosstest test_arith properly tests i8/i16.

The problem is that because of C++ integral promotion rules, many of the i8 and i16 arithmetic tests were actually being performed as i32 operations.  Thus we weren't actually testing everything we meant to test.

The fix is to have a python script auto-generate the relevant tests with proper typing.

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

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

8 years agoRemoved an extraneous tab
Thomas Lively [Tue, 31 May 2016 18:44:22 +0000 (11:44 -0700)]
Removed an extraneous tab

BUG=None
R=kschimpf@google.com

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

8 years ago- This patch implements lowerstore for i32, i64 types for mips32 arch.
Mohit Bhakkad [Tue, 31 May 2016 18:19:03 +0000 (11:19 -0700)]
- This patch implements lowerstore for i32, i64 types for mips32 arch.

- InstMIPS32Memory class is added to represent memory related instructions(load/store). I will add remaining load/store instructions if you are okay with this patch.

- Changed uncond_br.ll test as it was failing due to hardcoded label no. expected in output.

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

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

Patch from Mohit Bhakkad <mohit.bhakkad@imgtec.com>.

8 years ago[Subzero][MIPS32] Implement i1 cast operations
Sagar Thakur [Mon, 30 May 2016 14:54:47 +0000 (07:54 -0700)]
[Subzero][MIPS32] Implement i1 cast operations

R=stichnot@chromium.org

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

Patch from Sagar Thakur <sagar.thakur@imgtec.com>.

8 years agoSubzero, MIPS32: Introduction of floating point registers
Srdjan Obucina [Fri, 27 May 2016 21:40:32 +0000 (14:40 -0700)]
Subzero, MIPS32: Introduction of floating point registers

This patch introduces floating point registers used for 32-bit
operations, and basic handling of FP values in operands. It is
partial work needed as a base for further work.

R=stichnot@chromium.org

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

Patch from Srdjan Obucina <Srdjan.Obucina@imgtec.com>.

8 years agoSubzero: Initial implementation of BB Local CSE
Manasij Mukherjee [Tue, 24 May 2016 21:25:04 +0000 (14:25 -0700)]
Subzero: Initial implementation of BB Local CSE

Adds Cfg::localCse for basic-block local common-subexpression elimination
If we have
    t1 = op b c
    t2 = op b c
This pass will replace future uses of t2 in a basic block by t1.

To enable, use -enable-experimental in O2

BUG=none
R=stichnot@chromium.org

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

8 years agoAdded bool folding machinery for MIPS32.
Sagar Thakur [Tue, 24 May 2016 13:25:50 +0000 (06:25 -0700)]
Added bool folding machinery for MIPS32.
Added implementation for conditional branch instructions.

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

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

Patch from Sagar Thakur <sagar.thakur@imgtec.com>.

8 years agoSubzero, MIPS32: Implements integer division instructions sdiv, udiv, srem, urem
Srdjan Obucina [Wed, 18 May 2016 18:31:15 +0000 (11:31 -0700)]
Subzero, MIPS32: Implements integer division instructions sdiv, udiv, srem, urem

This patch adds support for missing integer division instruction sdiv, udiv, srem, urem.

R=stichnot@chromium.org

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

Patch from Srdjan Obucina <Srdjan.Obucina@imgtec.com>.