OSDN Git Service
Nicolas Capens [Fri, 2 Sep 2016 14:22:57 +0000 (10:22 -0400)]
Fix Visual Studio compilation of types within template classes.
BUG=swiftshader:7
Change-Id: I0c51c67b6f19a061dfff83415df5e41ea0efd6de
Reviewed-on: https://chromium-review.googlesource.com/380596
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Nicolas Capens [Thu, 1 Sep 2016 20:53:49 +0000 (16:53 -0400)]
Enable disabling API-based TLS support.
BUG=swiftshader:7
Change-Id: I0ef3b0ab059bd48e0241eea13a5b77a193351108
Reviewed-on: https://chromium-review.googlesource.com/380275
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Nicolas Capens [Thu, 1 Sep 2016 20:22:36 +0000 (16:22 -0400)]
Work around Visual Studio static constexpr bug.
Visual Studio doesn't recognize the use of a class member in a static
constexpr unless prefixed with the class name.
BUG=swiftshader:7
Change-Id: I4ffbaa6fc1a43a7294ecdaf426bd7fc2aab5e469
Reviewed-on: https://chromium-review.googlesource.com/380195
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Nicolas Capens [Thu, 1 Sep 2016 15:04:46 +0000 (11:04 -0400)]
Fix type alias compilation issue on Windows.
With Visual Studio 2015, the Traits type alias is not considered
within scope yet for the constructor's argument list. Instead Use
the template argument directly.
BUG=swiftshader:7
Change-Id: I677f5bed1a4749aba921a23ed5b1466431147069
Reviewed-on: https://chromium-review.googlesource.com/379915
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Nicolas Capens [Thu, 1 Sep 2016 19:05:49 +0000 (15:05 -0400)]
Allow using SZTARGET without PNACL_LLVM.
BUG=swiftshader:7
Change-Id: If0cfad149ba6ba7bc17708e8a6e5183189eeef5c
Reviewed-on: https://chromium-review.googlesource.com/379876
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Jaydeep Patil [Sun, 4 Sep 2016 14:19:08 +0000 (07:19 -0700)]
[SubZero] Implement load and store for MIPS
This patch implements lowerLoad and extends existing lowerStore for byte, short and floating-point types.
The patch also modifies PostLoweringLegalizer for conversion of mov to load or store.
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/
2301303003 .
Patch from Jaydeep Patil <jaydeep.patil@imgtec.com>.
Nicolas Capens [Thu, 1 Sep 2016 15:29:43 +0000 (11:29 -0400)]
Simplify ClFlags macro for older C++ standards.
Visual Studio 2015 does not support the use of typename outside of a
template definition. Instead alias the flag's storage type. This
even avoids some duplication.
BUG=swiftshader:7
Change-Id: I787701f6bfe8e36169e6ac5d63fcb6a1a114bdb0
Nicolas Capens [Fri, 2 Sep 2016 16:51:03 +0000 (16:51 +0000)]
Merge "Implement ICE_CACHELINE_BOUNDARY for Visual Studio."
Jim Stichnoth [Fri, 2 Sep 2016 13:29:48 +0000 (06:29 -0700)]
Subzero: Add the MIPS=1 makefile option for alternate testing mode.
There are two problems to address:
1. Google developers lack some tooling to test MIPS changes.
2. MIPS developers lack some tooling/packages to allow full "make presubmit" testing.
Until all this gets sorted out, we add the "make -f Makefile.standalone MIPS=1" option to control some of the testing targets:
check-lit: No changes, as all these lit tests should be runnable in both environments.
check-xtest: MIPS=1 runs just the mips32 tests, plus the x8664 native tests as a sanity-check. Non-MIPS runs everything except the mips32 tests.
check-spec: MIPS=1 completely disables spec2k testing.
presubmit: MIPS=1 greatly reduces the number of tests (especially since so many are spec variants).
With this change, mips32 CLs should pass "make -f Makefile.standalone MIPS=1 presubmit" before upload, and other CLs should pass "make -f Makefile.standalone presubmit".
BUG= none
R=kschimpf@google.com, obucinac@gmail.com
Review URL: https://codereview.chromium.org/
2271053006 .
Nicolas Capens [Thu, 1 Sep 2016 15:40:49 +0000 (11:40 -0400)]
Implement ICE_CACHELINE_BOUNDARY for Visual Studio.
BUG=swiftshader:7
Change-Id: I1c40c10b3c3d032d3f7e0f8634c7c9abcc21d130
Jim Stichnoth [Wed, 31 Aug 2016 22:32:32 +0000 (15:32 -0700)]
Subzero: Deterministically sort local var stack offsets.
Currently, TargetLowering::sortVarsByAlignment() uses the variable's required alignment as the primary key, but then std::sort() breaks ties arbitrarily. This can give different results across different STL implementations, for example when building against LLVM trunk versus building in the PNaCl environment.
The fix is to use Variable::Number as the secondary key.
BUG= none
R=kschimpf@google.com
Review URL: https://codereview.chromium.org/
2295393002 .
Jim Stichnoth [Wed, 31 Aug 2016 20:42:00 +0000 (13:42 -0700)]
Subzero: Fix a build error against LLVM trunk.
LLVM commit
1d79fff9e65e77f84bf80c2cf4f0155bd167c90d changed the way ilist::reverse_iterator is converted to ilist::iterator.
See https://github.com/llvm-mirror/llvm/commit/
1d79fff9e65e77f84bf80c2cf4f0155bd167c90d
BUG= none
R=kschimpf@google.com
Review URL: https://codereview.chromium.org/
2297363002 .
Jaydeep Patil [Wed, 31 Aug 2016 12:10:03 +0000 (05:10 -0700)]
[SubZero] Implement lowerSwitch for MIPS
The patch implements lowerSwitch for i32 and i64 types.
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/
2289043002 .
Patch from Jaydeep Patil <jaydeep.patil@imgtec.com>.
Jim Stichnoth [Mon, 29 Aug 2016 17:15:18 +0000 (10:15 -0700)]
Subzero: Fix the LLVM trunk build.
The original Ice::Inst needed a bit of template specialization so that llvm::ilist<Ice::Inst> methods wouldn't try to invoke private/deleted ctor/dtor methods. The Subzero code copied a pattern fairly widely used in LLVM.
Recently, LLVM improved ilist<> so that this specialization is no longer needed.
BUG= none
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/
2287363002 .
Jaydeep Patil [Mon, 29 Aug 2016 12:14:05 +0000 (05:14 -0700)]
[SubZero] Generate ELF output for MIPS
This patch adds encoding of few arithmetic and branch instructions.
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/
2259983004 .
Patch from Jaydeep Patil <jaydeep.patil@imgtec.com>.
Jaydeep Patil [Fri, 26 Aug 2016 20:27:40 +0000 (13:27 -0700)]
Delete unconditional branch to the next node.
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/
2275883002 .
Patch from Jaydeep Patil <jaydeep.patil@imgtec.com>.
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>.
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>.
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>.
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 .
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 .
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 .
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 .
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 .
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 .
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>.
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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>.
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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>.
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 .
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 .
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 .
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 .
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>.
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 .
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 .
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>.
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 .
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>.
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>.
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 .
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 .
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>.
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>.
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 .
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 .
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 .
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>.
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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>.
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>.
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>.
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>.
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>.
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>.
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 .
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 .
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 .
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 .
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 .
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 .
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>.
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .