Skip to content
  1. May 29, 2013
  2. May 28, 2013
  3. May 27, 2013
    • Preston Gurd's avatar
      Convert sqrt functions into sqrt instructions when -ffast-math is in effect. · 048f99de
      Preston Gurd authored
      When -ffast-math is in effect (on Linux, at least), clang defines
      __FINITE_MATH_ONLY__ > 0 when including <math.h>. This causes the
      preprocessor to include <bits/math-finite.h>, which renames the sqrt functions.
      For instance, "sqrt" is renamed as "__sqrt_finite". 
      
      This patch adds the 3 new names in such a way that they will be treated
      as equivalent to their respective original names.
      
      llvm-svn: 182739
      048f99de
    • Hal Finkel's avatar
      PPC: Add a isConsecutiveLS utility function · 8ebfe6c2
      Hal Finkel authored
      isConsecutiveLS is a slightly more general form of
      SelectionDAG::isConsecutiveLoad. Aside from also handling stores, it also does
      not assume equality of the chain operands is necessary. In the case of the PPC
      backend, this chain condition is checked in a more general way by the
      surrounding code.
      
      Mostly, this part of the refactoring in preparation for supporting optimized
      unaligned stores.
      
      llvm-svn: 182723
      8ebfe6c2
  4. May 26, 2013
    • Hal Finkel's avatar
      Prefer to duplicate PPC Altivec loads when expanding unaligned loads · 7d8a691b
      Hal Finkel authored
      When expanding unaligned Altivec loads, we use the decremented offset trick to
      prevent page faults. Unfortunately, if we have a sequence of consecutive
      unaligned loads, this leads to suboptimal code generation because the 'extra'
      load from the first unaligned load can be combined with the base load from the
      second (but only if the decremented offset trick is not used for the first).
      Search up and down the chain, through loads and token factors, looking for
      consecutive loads, and if one is found, don't use the offset reduction trick.
      These duplicate loads are later combined to yield the desired sequence (in the
      future, we might want a more-powerful chain search, but that will require some
      changes to allow the combiner routines to access the AA object).
      
      This should complete the initial implementation of the optimized unaligned
      Altivec load expansion. There is some refactoring that should be done, but
      that will happen when the unaligned store expansion is added.
      
      llvm-svn: 182719
      7d8a691b
  5. May 25, 2013
    • Hal Finkel's avatar
      PPC: Combine duplicate (offset) lvsl Altivec intrinsics · bc2ee4c4
      Hal Finkel authored
      The lvsl permutation control instruction is a function only of the alignment of
      the pointer operand (relative to the 16-byte natural alignment of Altivec
      vectors). As a result, multiple lvsl intrinsics where the operands differ by a
      multiple of 16 can be combined.
      
      llvm-svn: 182708
      bc2ee4c4
    • Andrew Trick's avatar
      Track IR ordering of SelectionDAG nodes 3/4. · e2431c64
      Andrew Trick authored
      Remove the old IR ordering mechanism and switch to new one.  Fix unit
      test failures.
      
      llvm-svn: 182704
      e2431c64
    • Andrew Trick's avatar
      Track IR ordering of SelectionDAG nodes 2/4. · ef9de2a7
      Andrew Trick authored
      Change SelectionDAG::getXXXNode() interfaces as well as call sites of
      these functions to pass in SDLoc instead of DebugLoc.
      
      llvm-svn: 182703
      ef9de2a7
    • Hal Finkel's avatar
      PPC: Initial support for permutation-based unaligned Altivec loads · cf2e9080
      Hal Finkel authored
      Altivec only directly supports aligned loads, but the loads have a strange
      property: If given an unaligned address, they truncate the address to the next
      lower aligned address, and load from there.  This property, along with an extra
      load and some special-purpose permutation-control instructions that generate
      the appropriate permutations from the original unaligned address, allow
      efficient lowering of aligned loads. This code uses the trick explained in the
      Apple Velocity Engine optimization overview document to prevent the needed
      extra load from possibly causing a page fault if the original address happens
      to be aligned.
      
      As noted in the FIXMEs, there are several additional optimizations that can be
      performed to reduce the cost of these loads even more. These will be
      implemented in future commits.
      
      llvm-svn: 182691
      cf2e9080
    • Quentin Colombet's avatar
      Follow up of the introduction of MCSymbolizer. · f482805c
      Quentin Colombet authored
      - Ressurect old MCDisassemble API to soften transition.
      - Extend MCTargetDesc to set target specific symbolizer.
      
      llvm-svn: 182688
      f482805c
    • Michael J. Spencer's avatar
  6. May 24, 2013
    • Richard Sandiford's avatar
      [SystemZ] Improve AsmParser handling of invalid instructions · dc5ed713
      Richard Sandiford authored
      Previously, an invalid instruction like:
      
      	foo     %r1, %r0
      
      would generate the rather odd error message:
      
      ....: error: unknown token in expression
      	foo     %r1, %r0
      		^
      
      We now get the more informative:
      
      ....: error: invalid instruction
      	foo     %r1, %r0
      	^
      
      The same would happen if an address were used where a register was expected.
      We now get "invalid operand for instruction" instead.
      
      llvm-svn: 182644
      dc5ed713
    • Richard Sandiford's avatar
      [SystemZ] Improve AsmParser register parsing · 675f8699
      Richard Sandiford authored
      The idea is to make sure that:
      
      (1) "register expected" is restricted to cases where ParseRegister()
          is called and the token obviously isn't a register.
      
      (2) "invalid register" is restricted to cases where a register-like "%..."
          sequence is found, but the "..." makes no sense.
      
      (3) the generic "invalid operand for instruction" is used in cases where
          the wrong register type is used (GPR instead of FPR, etc.).
      
      (4) the new "invalid register pair" is used if the register has the right type,
          but is not a valid register pair.
      
      Testing of (1)-(3) is now restricted to regs-bad.s.  It uses a representative
      instruction for each register class to make sure that only registers from
      that class are accepted.
      
      (4) is tested by both regs-bad.s (which checks all invalid register pairs)
      and insn-bad.s (which tests one invalid pair for each instruction that
      requires a pair).
      
      While there, I changed "Number" to "Num" for consistency with the
      operand class.
      
      llvm-svn: 182643
      675f8699
    • Benjamin Kramer's avatar
      Remove the Copied parameter from MemoryObject::readBytes. · 534d3a46
      Benjamin Kramer authored
      There was exactly one caller using this API right, the others were relying on
      specific behavior of the default implementation. Since it's too hard to use it
      right just remove it and standardize on the default behavior.
      
      Defines away PR16132.
      
      llvm-svn: 182636
      534d3a46
    • Ahmed Bougacha's avatar
      MC: Disassembled CFG reconstruction. · aa790681
      Ahmed Bougacha authored
      This patch builds on some existing code to do CFG reconstruction from
      a disassembled binary:
      - MCModule represents the binary, and has a list of MCAtoms.
      - MCAtom represents either disassembled instructions (MCTextAtom), or
        contiguous data (MCDataAtom), and covers a specific range of addresses.
      - MCBasicBlock and MCFunction form the reconstructed CFG. An MCBB is
        backed by an MCTextAtom, and has the usual successors/predecessors.
      - MCObjectDisassembler creates a module from an ObjectFile using a
        disassembler. It first builds an atom for each section. It can also
        construct the CFG, and this splits the text atoms into basic blocks.
      
      MCModule and MCAtom were only sketched out; MCFunction and MCBB were
      implemented under the experimental "-cfg" llvm-objdump -macho option.
      This cleans them up for further use; llvm-objdump -d -cfg now generates
      graphviz files for each function found in the binary.
      
      In the future, MCObjectDisassembler may be the right place to do
      "intelligent" disassembly: for example, handling constant islands is just
      a matter of splitting the atom, using information that may be available
      in the ObjectFile. Also, better initial atom formation than just using
      sections is possible using symbols (and things like Mach-O's
      function_starts load command).
      
      This brings two minor regressions in llvm-objdump -macho -cfg:
      - The printing of a relocation's referenced symbol.
      - An annotation on loop BBs, i.e., which are their own successor.
      
      Relocation printing is replaced by the MCSymbolizer; the basic CFG
      annotation will be superseded by more related functionality.
      
      llvm-svn: 182628
      aa790681
    • Ahmed Bougacha's avatar
      Add MCSymbolizer for symbolic/annotated disassembly. · ad1084de
      Ahmed Bougacha authored
      This is a basic first step towards symbolization of disassembled
      instructions. This used to be done using externally provided (C API)
      callbacks. This patch introduces:
      - the MCSymbolizer class, that mimics the same functions that were used
        in the X86 and ARM disassemblers to symbolize immediate operands and
        to annotate loads based off PC (for things like c string literals).
      - the MCExternalSymbolizer class, which implements the old C API.
      - the MCRelocationInfo class, which provides a way for targets to
        translate relocations (either object::RelocationRef, or disassembler
        C API VariantKinds) to MCExprs.
      - the MCObjectSymbolizer class, which does symbolization using what it
        finds in an object::ObjectFile. This makes simple symbolization (with
        no fancy relocation stuff) work for all object formats!
      - x86-64 Mach-O and ELF MCRelocationInfos.
      - A basic ARM Mach-O MCRelocationInfo, that provides just enough to
        support the C API VariantKinds.
      
      Most of what works in otool (the only user of the old symbolization API
      that I know of) for x86-64 symbolic disassembly (-tvV) works, namely:
      - symbol references: call _foo; jmp 15 <_foo+50>
      - relocations:       call _foo-_bar; call _foo-4
      - __cf?string:       leaq 193(%rip), %rax ## literal pool for "hello"
      Stub support is the main missing part (because libObject doesn't know,
      among other things, about mach-o indirect symbols).
      
      As for the MCSymbolizer API, instead of relying on the disassemblers
      to call the tryAdding* methods, maybe this could be done automagically
      using InstrInfo? For instance, even though PC-relative LEAs are used
      to get the address of string literals in a typical Mach-O file, a MOV
      would be used in an ELF file. And right now, the explicit symbolization
      only recognizes PC-relative LEAs. InstrInfo should have already have
      most of what is needed to know what to symbolize, so this can
      definitely be improved.
      
      I'd also like to remove object::RelocationRef::getValueString (it seems
      only used by relocation printing in objdump), as simply printing the
      created MCExpr is definitely enough (and cleaner than string concats).
      
      llvm-svn: 182625
      ad1084de
    • Ulrich Weigand's avatar
      · 99485469
      Ulrich Weigand authored
      [PowerPC] Remove symbolLo/symbolHi instruction operand types
      
      Now that there is no longer any distinction between symbolLo
      and symbolHi operands in either printing, encoding, or parsing,
      the operand types can be removed in favor of simply using
      s16imm.
      
      This completes the patch series to decouple lo/hi operand part
      processing from the particular instruction whose operand it is.
      
      No change in code generation expected from this patch.
      
      llvm-svn: 182618
      99485469
    • Ulrich Weigand's avatar
      · 41789de1
      Ulrich Weigand authored
      [PowerPC] Clean up generation of ha16() / lo16() markers
      
      When targeting the Darwin assembler, we need to generate markers ha16() and
      lo16() to designate the high and low parts of a (symbolic) immediate.  This
      is necessary not just for plain symbols, but also for certain symbolic
      expression, typically along the lines of ha16(A - B).  The latter doesn't
      work when simply using VariantKind flags on the symbol reference.
      This is why the current back-end uses hacks (explicitly called out as such
      via multiple FIXMEs) in the symbolLo/symbolHi print methods.
      
      This patch uses target-defined MCExpr codes to represent the Darwin
      ha16/lo16 constructs, following along the lines of the equivalent solution
      used by the ARM back end to handle their :upper16: / :lower16: markers.
      This allows us to get rid of special handling both in the symbolLo/symbolHi
      print method and in the common code MCExpr::print routine.  Instead, the
      ha16 / lo16 markers are printed simply in a custom print routine for the
      target MCExpr types.  (As a result, the symbolLo/symbolHi print methods
      can now replaced by a single printS16ImmOperand routine that also handles
      symbolic operands.)
      
      The patch also provides a EvaluateAsRelocatableImpl routine to handle
      ha16/lo16 constructs.  This is not actually used at the moment by any
      in-tree code, but is provided as it makes merging into David Fang's
      out-of-tree Mach-O object writer simpler.
      
      Since there is no longer any need to treat VK_PPC_GAS_HA16 and
      VK_PPC_DARWIN_HA16 differently, they are merged into a single
      VK_PPC_ADDR16_HA (and likewise for the _LO16 types).
      
      llvm-svn: 182616
      41789de1
  7. May 23, 2013
Loading