1. 27 Aug, 2014 3 commits
  2. 26 Aug, 2014 4 commits
  3. 18 Aug, 2014 1 commit
    • Subzero: Fix the simple register allocation for -Om1. · 4d79fe5b
      Jim Stichnoth authored
      Background: After lowering each high-level ICE instruction, Om1 calls
      postLower() to do simple register allocation.  It only assigns
      registers where absolutely necessary, specifically for infinite-weight
      variables, while honoring pre-coloring decisions.  The original Om1
      register allocation never tried to reuse registers within a lowered
      sequence, which was generally OK except for very long lowering
      sequences, such as call instructions or some intrinsics.  In these
      cases, when it ran out of physical registers, it would just reset the
      free list and hope for the best, but with no guarantee of correctness.
      
      The fix involves keeping track of which instruction in the lowered
      sequence holds the last use of each variable, and releasing each
      register back to the free list after its last use.  This makes much
      better use of registers.  It's not necessarily optimal, at least with
      respect to pre-colored variables, since those registers are
      black-listed even if they don't interfere with an infinite-weight
      variable.
      
      BUG= none
      R=jvoung@chromium.org
      
      Review URL: https://codereview.chromium.org/483453002
  4. 15 Aug, 2014 2 commits
  5. 14 Aug, 2014 2 commits
    • Subzero: Align spill locations to natural alignment. · d4799f47
      Matt Wala authored
      This requires sorting the spilled variables based on alignment and
      introducing additional padding around the spill location areas.
      
      These changes allow vector instructions to accept memory operands.
      
      Old stack frame layout:  New stack frame layout:
      +---------------------+  +---------------------+
      | return address      |  | return address      |
      +---------------------+  +---------------------+
      | preserved registers |  | preserved registers |
      +---------------------+  +---------------------+
      | global spill area   |  | padding             |
      +---------------------+  +---------------------+
      | local spill area    |  | global spill area   |
      +---------------------+  +---------------------+
      | padding             |  | padding             |
      +---------------------+  +---------------------+
      | local variables     |  | local spill area    |
      +---------------------+  +---------------------+
                               | padding             |
                               +---------------------+
                               | local variables     |
                               +---------------------+
      
      BUG=none
      R=jvoung@chromium.org, stichnot@chromium.org
      
      Review URL: https://codereview.chromium.org/465413003
    • Emit .local before .comm for bss to make llvm-mc happy. · f820da5e
      Jan Voung authored
      Otherwise llvm-mc asserts. This is also the order that llc emits the directives.
      Change a couple of RUIN -> RUN in lit tests.
      
      BUG=none
      R=stichnot@chromium.org
      
      Review URL: https://codereview.chromium.org/469973002
  6. 13 Aug, 2014 1 commit
    • Convert lit test llvm-mc -arch arguments to full -triple. · c8e87812
      Jan Voung authored
      Mostly to make them a bit more portable across OSes.
      Otherwise the OS assumed by llvm-mc is the build/host OS. So,
      on Mac llvm-mc will assume it's targeting darwin and only accepts macho
      assembler directives. Assembler directives like .rodata.cst8 are not accepted
      (I'm guessing it uses .cstring, .literal4, etc. instead?).
      
      Force an OS (NaCl) so that ELF-related assembler macros make sense.
      
      Also remove a now unused function typeIdentString to make clang happy.
      
      Example errors:
      Command 5 Stderr:
      <stdin>:5:2: error: unknown directive
              .type   fixed_400,@function
              ^
      <stdin>:23:2: error: unknown directive
              .type   variable_n,@function
              ^
      <stdin>:40:11: error: mach-o section specifier uses an unknown section type
              .section        .rodata.cst4,"aM",@progbits,4
                              ^
      <stdin>:42:11: error: mach-o section specifier uses an unknown section type
              .section        .rodata.cst8,"aM",@progbits,8
                              ^
      
      BUG=none
      R=stichnot@chromium.org, wala@chromium.org
      
      Review URL: https://codereview.chromium.org/467103004
  7. 12 Aug, 2014 4 commits
  8. 08 Aug, 2014 3 commits
  9. 07 Aug, 2014 2 commits
    • Subzero: Use scalar arithmetic when no vector instruction exists. · afeaee41
      Matt Wala authored
      Implement scalarizeArithmetic() which extracts the components of the
      input vectors, performs the operation with scalar instructions, and
      builds the output vector component by component.
      
      Fix the lowering of sdiv and srem.  These were previously emitting a
      wrong instruction (cdq) for i8 and i16 inputs (needing cbw, cwd).
      
      In the test_arith crosstest, mask the inputs to vector shift
      operations to ensure that the shifts are in range.  Otherwise the
      Subzero output is not identical to the llc output in some (undefined)
      cases.
      
      BUG=none
      R=stichnot@chromium.org
      
      Review URL: https://codereview.chromium.org/443203003
    • Subzero: A few fixes toward running larger programs. · 206833c6
      Jim Stichnoth authored
      1. Add 'llvm2ice -disable-globals' to disable Subzero translation of
      global initializers, since full support isn't yet implemented.
      
      2. Change the names of intra-block branch target labels to avoid
      collisions with basic block labels.
      
      3. Fix lowering of "br i1 <constant>, label ...", which was producing
      invalid instructions like "cmp 1, 0".
      
      4. Fix the "make format-diff" operation, which was diffing against the wrong target.
      
      BUG= none
      R=wala@chromium.org
      
      Review URL: https://codereview.chromium.org/449093002
  10. 05 Aug, 2014 1 commit
    • Subzero: Fix and clean up some cross tests. · 7da431b5
      Jim Stichnoth authored
      1. It turns out that the crosstest scripts mix different versions of
      clang - build_pnacl_ir.py uses pnacl-clang from the NaCl SDK for the
      tests, while crosstest.py uses clang/clang++ from LLVM_BIN_PATH for
      the driver.  The SDK has been updated to use a different version of
      the standard library, and now there is a mismatch as to whether int8_t
      is typedef'd to 'char' or 'signed char', leading to name mangling
      mismatches.  (char, signed char, and unsigned char are distinct
      types.)  We deal with this by using myint8_t which is explicitly
      defined as signed char.
      
      2. Some ugly function pointer casting in test_arith_main.cpp is fixed/removed.
      
      3. std::endl is replaced with "\n".
      
      4. License text is added to tests that were touched by the above items.
      
      BUG= none
      R=wala@chromium.org
      
      Review URL: https://codereview.chromium.org/435353002
  11. 31 Jul, 2014 1 commit
    • Subzero: Fix some issues related to legalization and undef handling. · e377767c
      Matt Wala authored
      1. Much of the lowering code for vector operations was not properly
      checking that the input operand was in a register or memory. This
      problem could be exhibited by passing undef values as inputs.
      
      => Change the vector legalization code to legalize input operands to
      register or memory before producing instructions that use the
      operands. Also, append a suffix to the variable names in the vector
      legalization code to clarify the legalization status of the values.
      
      2. Undef values should never be emitted directly. Rather, they should
      have been appropriately legalized to a zero value.
      
      => To enforce this, make ConstantUndef::emit() issue an error
      message. Do this in the x86 backend, as other backends may decide to
      treat undef values differently.
      
      3. The regalloc_evict_non_overlap test was loading from an undef
      pointer. Subzero was not handling this correctly (the undef pointer was
      being emitted without being legalized), but it does not have to handle
      this case since PNaCl IR disallows undef pointers.
      
      => Fix the regalloc_evict_non_overlap test to use an inttoptr instead of
      directly loading from the undef pointer. Also, add an assert in
      IceTargetLoweringX8632::FormMemoryOperand() to make sure that undef
      pointers are never encountered.
      
      BUG=none
      R=jvoung@chromium.org, stichnot@chromium.org
      
      Review URL: https://codereview.chromium.org/432613002
  12. 30 Jul, 2014 6 commits
  13. 29 Jul, 2014 1 commit
  14. 28 Jul, 2014 2 commits
    • A couple of fixes for using Makefile.standalone on Mac. · 839c4cea
      Jan Voung authored
      (*) PNaCl toolchain_build builds 64-bit libraries for LLVM on Mac.
          That won't link with subzero code if subzero is built with -m32,
          so add an option to override the -m32.
      (*) include locale header
      (*) Mark xMacroIntegrityCheck unused to avoid clang compiler warning.
      (*) virtual dtor, for inheritable class
      (*) Mark compare function const
      
      BUG=none
      R=stichnot@chromium.org
      
      Review URL: https://codereview.chromium.org/428733003
    • Subzero: Make Ice::Ostream a typedef for llvm::raw_ostream. · 78282f6c
      Jim Stichnoth authored
      Previously Ostream was a class that wrapped a raw_ostream pointer,
      structured that way in case we wanted to wrap an alternate stream
      type.
      
      Also, Ostream used to include a Cfg pointer, but that had to go away
      when the Ostream became associated with the GlobalContext which
      persists beyond the Cfg lifetime, so the Cfg pointer was removed
      leaving only the raw_ostream.
      
      Since llvm::raw_ostream is supposed to be very lightweight, we can
      just give up the abstraction and equate it to Ice::Ostream.
      
      BUG= none
      R=kschimpf@google.com
      
      Review URL: https://codereview.chromium.org/413393005
  15. 25 Jul, 2014 1 commit
  16. 24 Jul, 2014 4 commits
  17. 23 Jul, 2014 2 commits