- 16 Oct, 2015 3 commits
-
-
Jim Stichnoth authored
Also remind the user of that option in IceConverter.cpp, similar to PNaClTranslator.cpp. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/1408023004 .
-
John Porto authored
With this CL, Spec2k built by the Sz ARM32 backend runs and verifies successfully. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1407063002 .
-
Karl Schimpf authored
Add code to handle spilling stack variables. That is, add code to handle loading and storing to stack addresses. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4334 R=jpp@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/1402403002 .
-
- 15 Oct, 2015 2 commits
-
-
Jim Stichnoth authored
1. Helper function sameVarOrReg() also needs to return true if the two physical registers alias or overlap. Otherwise advanced phi lowering may pick an incorrect ordering. 2. With -asm-verbose, redundant truncation assignments expressed as _mov instructions, like "mov cl, ecx", need to have their register use counts updated properly, so that the LIVEEND= annotations are correct. 3. The register allocator should consider suitably typed aliases when choosing a register preference. 4. When evicting a variable, the register allocator should decrement the use count of all aliases. 5. When saving/restoring callee-save registers in the prolog/epilog, map each register to its "canonical" register (e.g. %bl --> %ebx) and make sure each canonical register is only considered once. 6. Remove some unnecessary Variable::setMustHaveReg() calls. 7. When assigning bool results as a constant 0 or 1, use an 8-bit constant instead of 32-bit so that only the 8-bit register gets assigned. BUG= none TEST= make check, plus spec2k -asm-verbose output is unchanged R=kschimpf@google.com Review URL: https://codereview.chromium.org/1405643003 .
-
David Sehr authored
Comparisons with zero can be done with no branches in most cases and with simpler sequences of operations. BUG= R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1406593003 .
-
- 14 Oct, 2015 1 commit
-
-
Karl Schimpf authored
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4334 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1388323003 .
-
- 13 Oct, 2015 2 commits
-
-
Karl Schimpf authored
Also does some bikeshed clean ups. In particualr, the (ARM) instruction method emitIAS only needs to choose the applicable ARM instruction, and then passes the corresponding operands to the corresponding instruction method of the assembler. The assembler method then extracts the appropriate data from the operands, and decides which rule to apply for the corresponding arm instruction. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4334 R=jpp@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/1407613002 .
-
Karl Schimpf authored
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4334 R=jpp@chromium.org Review URL: https://codereview.chromium.org/1397043003 .
-
- 12 Oct, 2015 1 commit
-
-
Jim Stichnoth authored
The original code only looked at top-level source operands in the defining instruction, with a TODO to instead consider all inner variables in the instruction. The primary reason is so that we end up with more instructions like mov eax, eax which are later elided as redundant assignments. A secondary reason is to foster more instructions like: mov ecx, [ecx] rather than mov eax, [ecx] where ecx's live range ends. This hopefully keeps eax (in the latter case) free for longer and maybe allow some other variable to get a register. By considering all instruction variables, we enable this. BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1392383003 .
-
- 09 Oct, 2015 5 commits
-
-
Jim Stichnoth authored
If a variable gets a register but is later evicted because of a higher-weight variable, there's a chance that the first variable could have been allocated a register if only its initial choice had been different. To improve this, we keep track of which variables are evicted, and then allow register allocation to run again, focusing only on those once-evicted variables, and not changing any previous register assignments. This can iterate until there are no more evictions. This is more or less what the linear-scan literature describes as "second-chance bin-packing". BUG= https://code.google.com/p/nativeclient/issues/detail?id=4095 R=jpp@chromium.org Review URL: https://codereview.chromium.org/1395693005 .
-
Karl Schimpf authored
Extends the ARM32 assembler to be able to generate a trivial function footprint using the -filetype=iasm option. Also does a couple of cleanups: 1) Move UnimplementedError macro to common location so that it can be used by everyone. 2) Add a GlobalContext argument to the assembler, so that it can look at flags etc. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4334 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1397933002 .
-
Jim Stichnoth authored
The LiveIn and LiveOut register sets are printed for each basic block in -asm-verbose mode. These sets would generally include the stack and/or frame pointer registers, which is just noise, so we suppress that. BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1399523003 .
-
Jim Stichnoth authored
In x86 lowering, i1 values are held in i8 register and memory slots. We were conservatively "and"ing them with 1 before zero-extending them for some lowering operations, but this "and" with 1 is unnecessary and just clutters the code. We continue the invariant that all i1-produced values in an i8 slot are either 0 or 1. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4095 R=jpp@chromium.org Review URL: https://codereview.chromium.org/1394413002 .
-
Jim Stichnoth authored
BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1392403002 .
-
- 08 Oct, 2015 2 commits
-
-
Jim Stichnoth authored
BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/1396923002 .
-
Karl Schimpf authored
Adds message to use "-allow-externally-defined-symbols" on bad linkage errors. Also cleans up code by defining common reporting routine. BUG=None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1392273002 .
-
- 07 Oct, 2015 3 commits
-
-
Karl Schimpf authored
Creates a local version of the Dart assembler code, before being merged into our code base. The goal of these files is to track code as it is moved from the Dart implementation into our code base. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4334 R=jpp@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/1394613002 .
-
Karl Schimpf authored
The existing code, when run on a fuzzed example, generates a runtime assertion. The reason for this is that the input defines "memmove" as an external global. However, the code generator can generate calls to "memmove" which assumes it is internal (see PNaCl ABI). As a result, the assertion that checks that global names are unique (for memmove) fails. This code fixes the problem by checking that global names are internal, unless they are one of the "start" functions, or the function is an intrinsic. To allow for non-PNaCl ABI input, a flag was added to allow functions to be external. However, in such cases the external can't be one of Subzero's runtime helper functions. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4330 R=jpp@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/1387963002 .
-
David Sehr authored
For operations such as t0 = t1 + t2 Subzero's pattern for arithmetic operations generates two address code that looks like movl ...t1..., %ecx addl ...t2..., %ecx // t0 is in %ecx When register pressure is high this sometimes becomes: movl ...t2..., SPILL movl ...t1..., %ecx addl SPILL, %ecx // t0 is in %ecx This CL takes advantage of cases where the use of t2 is the last one, so the register that held t2 before the operation can be reused. The optimization simply swaps the (commutative) operation to t0 = t2 + t1 which then generates code as movl ...t2..., %ecx addl ...t1..., %ecx // t0 is in %ecx This optimization is used for any commutative operation, which now includes Fadd and Fmul, which were erroneously marked as non-commutative. See the rationale in IceInst.def for the IEEE wordings. BUG= R=jfb@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/1371703003 .
-
- 06 Oct, 2015 2 commits
-
-
David Sehr authored
Previously we did not take advantage of the three address versions of the imul instruction. With this we are able to avoid some copies before imuls. BUG= R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1365433004 .
-
John Porto authored
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1369333003 .
-
- 05 Oct, 2015 3 commits
-
-
Jim Stichnoth authored
Originally, the lowering sequence looked like: T = b T *= b a = T Now it looks like: T = b T *= T a = T If "b" gets a register and its live range ends after this instruction, then the new lowering sequence allows its register to be reused for "T". This decreases register pressure, and removes an instruction (register move) from what could be a critical path. This optimization is actually applicable for most arithmetic operations whose source operands are identical, but mul/fmul are the only ones that seem at all likely in practice. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/1377213004 .
-
Jim Stichnoth authored
This issue was discovered as the result of a spurious "make check-lit" failure in undef.ll. The problem is that constant pool label strings depend on the order the constants are created, and this order can be different with multithreaded translation. Even -filetype=obj is affected by this, because the label string is put into the ELF .o file. This means that different runs of Subzero on the same input could potentially produce slightly different output. The solution is to base the label name on the actual value of the constant. We do this by using the hex representation of the constant, rather than the sequence number of the constant within the pool. This actually simplifies things a bit, as we no longer need to track the sequence number. In addition, for floating-point constant labels in asm-verbose mode, include a human-readable rendering of the value in the label name. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/1386593004 .
-
Jim Stichnoth authored
Instead of a comment like this: # preds=.Lfv_update_nonbon$split___114___115_0,.Lfv_update_nonbon$split___138___115_1 remove some redundancy and make the comment like this: # preds=$split___114___115_0,$split___138___115_1 This makes it slightly easier to read, and less likely to exceed 80 columns. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/1380323003 .
-
- 02 Oct, 2015 3 commits
-
-
Karl Schimpf authored
The pnacl linux x86_64 buildbot doesn't understand ::stdout (it uses a macro to define stdout). Fix by removing :: prefix. Also redirects the error messages to stderr instead of stdout. BUG=None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1383053002 .
-
Karl Schimpf authored
Fixes bug in function reportFatalErrorThenExitSuccess by using fwrite instead of write (a unix posix include file not supported by MSC). BUG=None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1370323005 .
-
Jim Stichnoth authored
The problem is that given code like this: a = b + c d = a + e ... ... (use of a) ... Lowering may produce code like this, at least on x86: T1 = b T1 += c a = T1 T2 = a T2 += e d = T2 ... ... (use of a) ... If "a" has a long live range, it may not get a register, resulting in clumsy code in the middle of the sequence like "a=reg; reg=a". Normally one might expect store forwarding to make the clumsy code fast, but it does presumably add an extra instruction-retirement cycle to the critical path in a pointer-chasing loop, and makes a big difference on some benchmarks. The simple fix here is, at the end of lowering "a=b+c", keep track of the final "a=T1" assignment. Then, when lowering "d=a+e" and we look up "a", we can substitute "T1". This slightly increases the live range of T1, but it does a great job of avoiding the redundant reload of the register from the stack location. A more general fix (in the future) might be to do live range splitting and let the register allocator handle it. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4095 R=kschimpf@google.com Review URL: https://codereview.chromium.org/1385433002 .
-
- 01 Oct, 2015 7 commits
-
-
John Porto authored
This is in preparation for llvm.nacl.atomic.* lowerings. atomic i64 loads and stores require their operands to be consecutive registers starting at an even register that is not r14. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=kschimpf@google.com Review URL: https://codereview.chromium.org/1382063002 .
-
John Porto authored
This bug was uncovered While implementing the llvm.nacl.atomic.cmpxchg lowering for i64 for ARM32. For reference, the lowering is retry: ldrexd tmp_i, tmp_i+1 [addr] cmp tmp_i+1, expected_i+1 cmpeq tmp_i, expected_i strexdeq success, new_i, new_i+1, [addr] movne expected_i+1, tmp_i+1 movne expected_i, tmp_i cmpeq success, #0 bne retry mov dest_i+1, tmp_i+1 mov dest_i, tmp_i The register allocator would allocate r4 to both success and new_i, which is clearly wrong (expected_i is alive thought the cmpxchg loop.) Adding a fake-use(new_i) after the loop caused the register allocator to fail due to the impossibility to allocate a register for an infinite weight register. The problem was being caused for not evicting live ranges that were assigned registers that alias the selected register. BUG= R=kschimpf@google.com, stichnot@chromium.org Review URL: https://codereview.chromium.org/1373823006 . -
John Porto authored
These instructions are used to load/store data atomically, and to notify the processor about a data memory barrier. They are used for implementing the llvm.nacl.atomic.* lowerings. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1378303003 .
-
Karl Schimpf authored
A recent change to IceCompilerServer.cpp was added to allow fatal errors to return exit status zero. However, this code called ::write (a C function) that is not defined when compiling with MSC. This CL adds includes to fix this problem. BUG=None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1379613005 .
-
Jim Stichnoth authored
When the register allocator decides whether to allow the candidate's live range to overlap its preferred variable's live range (and share their register), it needs to consider whether any redefinitions in one variable occur within the live range of the other variable, in which case overlap should not be allowed. There was a bug in the API for iterating over the defining instructions for a variable, in which the earliest definition might be ignored in some cases. This came from the fact that the first definition and latter definitions are split apart for translation speed reasons, and a particular API is needed for finding an unambiguous first definition, which is possible when all definitions are within a single block but not so possible when definitions cross block boundaries. (This only happens for the simple phi lowering.) Since both semantics are needed, a separate API is added to support both. For spec2k, the asm output is identical to before, so this changes nothing. When translating spec2k with "-O2 -phi-edge-split=0", there is a single minor difference in ammp that actually looks legit in both cases. However, when testing an upcoming CL, -phi-edge-split=0 triggered the bug, causing gcc and crafty to fail with incorrect output. This CL also fixes some minor issues, and adds dump output of the instruction definition list when available. BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1381563004 .
-
Jim Stichnoth authored
The std::list<> implementation used by g++ needs some extra stuff defined in the custom allocator. This can be smoke-tested with: make -f Makefile.standalone CXX=g++ LLVM_EXTRA_WARNINGS="-Wno-unknown-pragmas -Wno-unused-parameter -Wno-comment -Wno-enum-compare -Wno-strict-aliasing" STDLIB_FLAGS= until the link fails for unrelated reasons. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4325 R=kschimpf@google.com Review URL: https://codereview.chromium.org/1367403004 .
-
Jim Stichnoth authored
Frame offsets for variables are emitted using a symbolic name based on the variable's name. This makes it a bit easier to digest the asm code. For example, if variable Foo gets an esp offset 24, asm like this: ... 24(%esp) ... will instead be emitted like this: lv$Foo = 24 ... ... lv$Foo(%esp) ... Predecessor labels are printed for each basic block. Loop nest depth is printed for each basic block. (Would be nice if we had loop header info as well.) BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1377323002 .
-
- 30 Sep, 2015 2 commits
-
-
Karl Schimpf authored
Moves the alignment check method from the function block parser, to the top-level parser, and then uses it to also check alignment on global variables. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4329 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1378163002 .
-
Karl Schimpf authored
Fixes pnacl-sz to return with exit status 0 in report_fatal_error, if command line flag --exit-status is specified. The importance of this is that it allows afl-fuzz to not report the mutation as a crash. In addition, afl-fuzz doesn't record crash paths in its search history. By returning success, afl-fuzz can continue to apply additional mutations to the bad input. This allows afl-fuzz to add errors that require multiple changes to occur on the input. BUG=None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1382653002 .
-
- 28 Sep, 2015 2 commits
-
-
Karl Schimpf authored
Fixes bug where code did not check that the address of an indirect call must be i32. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4321 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1363983002 .
-
John Porto authored
This is in preparation for adding atomic support to the ARM backend. Moreover, the code is becoming increasingly complicated due to the use of Variable64On32 as instruction operands. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=kschimpf@google.com Review URL: https://codereview.chromium.org/1372083002 .
-
- 26 Sep, 2015 1 commit
-
-
Jim Stichnoth authored
1. Rename all identifiers containing "nonkillable" to use the more understandable "redefined". 2. Change inferTwoAddress() to be called inferRedefinition(), and to check *all* instruction source variables (instead of just the first source operand) against the Dest variable. This eliminates the need for several instances of _set_dest_redefined(). The performance impact on translation time is something like 0.1%, which is dwarfed by the usability gain. 3. Change a cryptic assert in (O2) live range construction to print detailed information on the liveness errors. 4. Change a cryptic assert in (Om1) live range construction to do the same. BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1368993004 .
-
- 25 Sep, 2015 1 commit
-
-
John Porto authored
This patch enables many crosstests for ARM32. Very limited vector support is implemented (essentially, whatever it takes to compile the .ll files contain vector operations.) Atomics as well as vector crosstests are still disabled. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1359193003 .
-