1. Dec 02, 2014
    • Daniel Sanders's avatar
      Merged from r221521: · df22cb2b
      Daniel Sanders authored
      [mips] Remove remaining use of MipsCC::intArgRegs() in favour of MipsABIInfo::GetByValArgRegs() and MipsABIInfo::GetVarArgRegs()
      
      Summary:
      
      Reviewers: theraven, vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D6113
      
      llvm-svn: 223053
      df22cb2b
    • Daniel Sanders's avatar
      Merged from r221519: · 40ddbe66
      Daniel Sanders authored
      [mips] Remove MipsCC::getRegVT(). NFC
      
      Summary: It's no longer used.
      
      Reviewers: vmedic, theraven
      
      Reviewed By: theraven
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D6112
      
      llvm-svn: 223052
      40ddbe66
    • Daniel Sanders's avatar
      Merged from r221518: · 901f3d19
      Daniel Sanders authored
      [mips] Remove MipsCC::analyzeCallOperands in favour of CCState::AnalyzeCallOperands. NFC
      
      Summary:
      In addition to the usual f128 workaround, it was also necessary to provide
      a means of accessing ArgListEntry::IsFixed.
      
      Reviewers: theraven, vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D6111
      
      llvm-svn: 223048
      901f3d19
    • Daniel Sanders's avatar
      Merged from r221517: · e4565b26
      Daniel Sanders authored
      [mips] Move SpecialCallingConv to MipsCCState and use it from tablegen-erated code. NFC
      
      Summary:
      In the long run, it should probably become a calling convention in its own
      right but for now just move it out of
      MipsISelLowering::analyzeCallOperands() so that we can drop this function
      in favour of CCState::AnalyzeCallOperands().
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D6085
      
      llvm-svn: 223047
      e4565b26
    • Daniel Sanders's avatar
      Merged from r221516: · 30d2ca75
      Daniel Sanders authored
      [mips] Removed IsVarArg from MipsISelLowering::analyzeCallOperands(). NFC.
      
      Summary:
      CCState objects already carry this information in their isVarArg() method.
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D6084
      
      llvm-svn: 223045
      30d2ca75
    • Daniel Sanders's avatar
      Merged from r221463: · 84a7df7e
      Daniel Sanders authored
      [mips] Removed IsSoftFloat from MipsISelLowering::analyzeCallOperands(). NFC
      
      Summary:
      It isn't used anymore.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D6083
      
      llvm-svn: 223044
      84a7df7e
    • Daniel Sanders's avatar
      Merged from r221461: · 2234ce57
      Daniel Sanders authored
      [mips] Removed MipsISelLowering::analyzeFormalArguments() in favour of CCState::AnalyzeFormalArguments()
      
      Summary:
      As with returns, we must be able to identify f128 arguments despite them
      being lowered away. We do this with a pre-analyze step that builds a
      vector and then we use this vector from the tablegen-erated code.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D6081
      
      llvm-svn: 223042
      2234ce57
    • Daniel Sanders's avatar
      Merged from r221146: · 88c94367
      Daniel Sanders authored
      [mips] Remove unused prototype and variable. NFC.
      
      llvm-svn: 223041
      88c94367
    • Daniel Sanders's avatar
      Merged from r221081 and r221102: · 81624a1b
      Daniel Sanders authored
      -------------------------------------------------------------------------------
      Revert r221056 and others, "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC."
      
        r221056 "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC."
        r221058 "[mips] Fix unused variable warning introduced in r221056"
        r221059 "[mips] Move all ByVal handling into CCState and tablegen-erated code. NFC."
        r221061 "Renamed CCState members that appear to misspell 'Processed' as 'Proceed'. NFC."
      
      It caused an undefined behavior in LLVM :: CodeGen/Mips/return-vector.ll.
      
      -------------------------------------------------------------------------------
      Re-commit r221056 and others with fix, "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC."
      
      sret arguments can never originate from an f128 argument so we detect
      sret arguments and push false into OriginalArgWasF128.
      
      llvm-svn: 223040
      81624a1b
    • Daniel Sanders's avatar
      Merged from r221061: · 55bcb7be
      Daniel Sanders authored
      Renamed CCState members that appear to misspell
       'Processed' as 'Proceed'. NFC.
      
      Reviewers: rnk
      
      Reviewed By: rnk
      
      Subscribers: rnk, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5978
      
      llvm-svn: 223039
      55bcb7be
  2. Dec 01, 2014
    • Daniel Sanders's avatar
      Merged from r221059: · 6b412de0
      Daniel Sanders authored
      [mips] Move all ByVal handling into CCState and tablegen-erated code. NFC.
      
      Summary:
      CCState already contains a byval implementation that is very similar to the
      Mips custom code. This patch merges the custom code into the existing
      common code and tablegen-erated code.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: rnk, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5977
      
      llvm-svn: 223037
      6b412de0
    • Daniel Sanders's avatar
      Merged from r221058: · 5cf014d8
      Daniel Sanders authored
      [mips] Fix unused variable warning introduced in r221056
      
      llvm-svn: 223036
      5cf014d8
    • Daniel Sanders's avatar
      Merged from r221057: · 9d2aa79b
      Daniel Sanders authored
      [mips] Remove ByValArgInfo::Address in favour of CCValAssign::getMemLocOffset(). NFC.
      
      Summary: ByValArgInfo is practically the same as CCState::ByValInfo now.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5976
      
      llvm-svn: 223035
      9d2aa79b
    • Daniel Sanders's avatar
      Merged from r221056: · 0dae6cdb
      Daniel Sanders authored
      [mips] Move F128 argument handling into MipsCCState as we did for returns. NFC.
      
      Summary:
      There are a couple more changes to make before analyzeFormalArguments can
      be merged into the standard AnalyzeFormalArguments. I've had to temporarily
      poke a couple holes in MipsCCState's encapsulation to save having to make
      all the required changes for this merge all at once*. These will be removed
      shortly.
      
      * We must merge our ByVal argument handling with the implementation in CCState.
        This will be done over the next three patches, then the fourth will merge
        analyzeFormalArguments with AnalyzeFormalArguments.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5969
      
      llvm-svn: 223034
      0dae6cdb
    • Daniel Sanders's avatar
      Merged from r221054: · 6d4022f7
      Daniel Sanders authored
      [mips] Remove MipsCC::CCInfo. NFC.
      
      Summary:
      It's now passed in as an argument to functions that need it. Eventually
      this argument will be replaced by the 'this' pointer for a MipsCCState
      object.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5967
      
      llvm-svn: 223033
      6d4022f7
    • Daniel Sanders's avatar
      Merged from r221053: · 372b086a
      Daniel Sanders authored
      [mips] Removed MipsCC::fixedArgFn(). NFC
      
      Summary:
      There is one remaining trace of it in MipsCC::analyzeCallOperands() where
      Mips16 might override the calling convention. This will moved into
      tablegen-erated code later.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5966
      
      llvm-svn: 223032
      372b086a
    • Daniel Sanders's avatar
      [tablegen] Add CustomCallingConv and use it to tablegen-erate the outermost... · 14866355
      Daniel Sanders authored
      [tablegen] Add CustomCallingConv and use it to tablegen-erate the outermost parts of the Mips O32 implementation
      
      Summary:
      CustomCallingConv is simply a CallingConv that tablegen should not generate the
      implementation for. It allows regular CallingConv's to delegate to these custom
      functions. This is (currently) necessary for Mips and we cannot use CCCustom
      without having to adapt to the different API that CCCustom uses.
      
      This brings us a bit closer to being able to remove
      MipsCC::analyzeCallOperands and MipsCC::analyzeFormalArguments in favour of
      the common implementation.
      
      No functional change to the targets.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: vmedic, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5965
      
      llvm-svn: 223031
      14866355
    • Daniel Sanders's avatar
      Added file that should have been in r223022. · 728f55c9
      Daniel Sanders authored
      I forgot to 'svn add' it.
      
      llvm-svn: 223030
      728f55c9
    • Daniel Sanders's avatar
      Add file that should have been in r223027 · 5ef6392a
      Daniel Sanders authored
      llvm-svn: 223028
      5ef6392a
    • Daniel Sanders's avatar
      Merged from r220568: · de7b942b
      Daniel Sanders authored
      [mips] Replace MipsABIEnum with a MipsABIInfo class.
      
      Summary:
      No functional change yet, it's just an object replacement for an enum.
      It will allow us to gather ABI information in a single place so that we can
      start testing for properties of the ABI's instead of the ABI itself.
      
      For example we will eventually be able to use:
        ABI.MinStackAlignmentInBytes()
      instead of:
        (isABI_N32() || isABI_N64()) ? 16 : 8
      which is clearer and more maintainable.
      
      Reviewers: matheusalmeida
      
      Reviewed By: matheusalmeida
      
      Differential Revision: http://reviews.llvm.org/D3341
      
      llvm-svn: 223027
      de7b942b
    • Daniel Sanders's avatar
      Merged from r220564: · 639afbbb
      Daniel Sanders authored
      [mips] Fix >80-column line
      
      llvm-svn: 223026
      639afbbb
    • Daniel Sanders's avatar
      Merged from r220561: · 7ed3d657
      Daniel Sanders authored
      [mips] Remove redundant code in RetCC_MipsN. NFC.
      
      Summary:
      i32 is always promoted to i64 so it no longer makes sense to assign i32 to
      registers.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5964
      
      llvm-svn: 223025
      7ed3d657
    • Daniel Sanders's avatar
      Merged from r220556: · 685924c7
      Daniel Sanders authored
      [mips] For N32/N64, structs must be passed in the upper bits of a register.
      
      Summary:
      Most structs were fixed by r218451 but those of between >32-bits and
      <64-bits remained broken since they were not marked with [ASZ]ExtUpper.
      This patch fixes the remaining cases by using
      CCPromoteToUpperBitsInType<i64> on i64's in addition to i32 and smaller.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5963
      
      llvm-svn: 223024
      685924c7
    • Daniel Sanders's avatar
      Merged from r219931: · b2d74150
      Daniel Sanders authored
      [mips] Account for endianess when expanding BuildPairF64/ExtractElementF64 nodes.
      
      Summary:
      In order to support big endian targets for the BuildPairF64 nodes we
      just need to swap the low/high pair registers. Additionally, for the
      ExtractElementF64 nodes we have to calculate the correct stack offset
      with respect to the node's register/operand that we want to extract.
      
      Reviewers: dsanders
      
      Reviewed By: dsanders
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5753
      
      llvm-svn: 223023
      b2d74150
    • Daniel Sanders's avatar
      Merged from r219196: · 08c8744a
      Daniel Sanders authored
      [mips] Return {f128} correctly for N32/N64.
      
      Summary:
      According to the ABI documentation, f128 and {f128} should both be returned
      in $f0 and $f2. However, this doesn't match GCC's behaviour which is to
      return f128 in $f0 and $f2, but {f128} in $f0 and $f1.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5578
      
      llvm-svn: 223022
      08c8744a
    • Daniel Sanders's avatar
      Merging r218452: · f5bcfc4f
      Daniel Sanders authored
      ------------------------------------------------------------------------
      r218452 | dsanders | 2014-09-25 14:08:51 +0100 (Thu, 25 Sep 2014) | 3 lines
      
      Add llvm_unreachables() for [ASZ]ExtUpper to X86FastISel.cpp to appease the buildbots.
      
      
      ------------------------------------------------------------------------
      
      llvm-svn: 223021
      f5bcfc4f
    • Daniel Sanders's avatar
      Merged from r218510: · d2d30b50
      Daniel Sanders authored
      Fix unused variable warning added in r218509
      
      llvm-svn: 223020
      d2d30b50
    • Daniel Sanders's avatar
      Merged from r218509: · d51f07da
      Daniel Sanders authored
      [mips] Generalize the handling of f128 return values to support f128 arguments.
      
      Summary:
      This will allow us to handle f128 arguments without duplicating code from
      CCState::AnalyzeFormalArguments() or CCState::AnalyzeCallOperands().
      
      No functional change.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5292
      
      llvm-svn: 223019
      d51f07da
    • Daniel Sanders's avatar
      Merged from r218451: · 08d315f5
      Daniel Sanders authored
      [mips] Add CCValAssign::[ASZ]ExtUpper and CCPromoteToUpperBitsInType and handle struct's correctly on big-endian N32/N64 return values.
      
      Summary:
      The N32/N64 ABI's require that structs passed in registers are laid out
      such that spilling the register with 'sd' places the struct at the lowest
      address. For little endian this is trivial but for big-endian it requires
      that structs are shifted into the upper bits of the register.
      
      We also require that structs passed in registers have the 'inreg'
      attribute for big-endian N32/N64 to work correctly. This is because the
      tablegen-erated calling convention implementation only has access to the
      lowered form of struct arguments (one or more integers of up to 64-bits
      each) and is unable to determine the original type.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5286
      
      llvm-svn: 223018
      08d315f5
    • Daniel Sanders's avatar
      Merged from r218036: · e9f61a12
      Daniel Sanders authored
      [mips] Remove custom versions of CCState::AnalyzeReturn() and CCState::AnalyzeCallReturn().
      
      Summary:
      The N32/N64 ABI's return f128 values in $f0 and $f2 for hard-float and $v0 and
      $a0 for soft-float. The registers used in the soft-float case differ from the
      usual $v0, and $v1 specified for return values.
      
      Both cases were previously handled by duplicating the CCState::AnalyzeReturn()
      and CCState::AnalyzeCallReturn() functions and modifying them to delegate to
      a different assignment function for f128 and further replace the register type
      for the hard-float case. There is a simpler way to do both of these.
      
      We now use the common functions and select an initial assignment function based
      on whether the original type is f128 or not. We then handle the hard-float case
      using CCBitConvertToType<>.
      
      No functional change.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5269
      
      llvm-svn: 223017
      e9f61a12
    • Daniel Sanders's avatar
      Merged from r217494: · f6bf6634
      Daniel Sanders authored
      [mips] Remove inverted predicates from MipsSubtarget that were only used by MipsCallingConv.td
      
      Summary: No functional change
      
      Reviewers: echristo, vmedic
      
      Reviewed By: echristo, vmedic
      
      Subscribers: echristo, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5266
      
      llvm-svn: 223016
      f6bf6634
    • Daniel Sanders's avatar
      Merged from r217485: · 2646c125
      Daniel Sanders authored
      [mips] Return an ArrayRef from MipsCC::intArgRegs() and remove MipsCC::numIntArgRegs()
      
      Summary: No functional change.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5265
      
      llvm-svn: 223015
      2646c125
    • Daniel Sanders's avatar
      Merged from r217436: · cc13b704
      Daniel Sanders authored
      [mips] Move MipsTargetLowering::MipsCC::regSize() to MipsSubtarget::getGPRSizeInBytes()
      
      Summary:
      The GPR size is more a property of the subtarget than that of the ABI so move
      this information to the MipsSubtarget.
      
      No functional change.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5009
      
      llvm-svn: 223014
      cc13b704
    • Daniel Sanders's avatar
      Merged from r217434: · 64f980a0
      Daniel Sanders authored
      [mips] Don't cache IsO32 and IsFP64 in MipsTargetLowering::MipsCC
      
      Summary:
      Use a MipsSubtarget reference instead.
      
      No functional change.
      
      Reviewers: vmedic
      
      Reviewed By: vmedic
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D5008
      
      llvm-svn: 223013
      64f980a0
    • Daniel Sanders's avatar
      Merged from r215640: · 3f173e82
      Daniel Sanders authored
      [mips] Improve robustness of some tests.
      
      Summary:
      This is done by removing some hardcoded registers like $at or expecting a single digit register to be selected.
      
      Contains work done by Matheus Almeida.
      
      Reviewers: matheusalmeida, dsanders
      
      Reviewed By: dsanders
      
      Subscribers: tomatabacu
      
      Differential Revision: http://reviews.llvm.org/D4227
      
      llvm-svn: 223012
      3f173e82
    • Daniel Sanders's avatar
      Merged from r215211: · 7863d07a
      Daniel Sanders authored
      [mips] Invert the abicalls feature bit to be noabicalls so that it's possible for -mno-abicalls to take effect.
      
      Also added the testcase that should have been in r215194.
      
      This behaviour has surprised me a few times now. The problem is that the
      generated MipsSubtarget::ParseSubtargetFeatures() contains code like this:
      
         if ((Bits & Mips::FeatureABICalls) != 0) IsABICalls = true;
      
      so '-abicalls' means 'leave it at the default' and '+abicalls' means 'set it to
      true'. In this case, (and the similar -modd-spreg case) I'd like the code to be
      
        IsABICalls = (Bits & Mips::FeatureABICalls) != 0;
      
      or possibly:
      
         if ((Bits & Mips::FeatureABICalls) != 0)
           IsABICalls = true;
         else
           IsABICalls = false;
      
      and preferably arrange for 'Bits & Mips::FeatureABICalls' to be true by default
      (on some triples).
      
      llvm-svn: 223011
      7863d07a
    • Daniel Sanders's avatar
      Merged from r215194: · 24b3307b
      Daniel Sanders authored
      [mips] Initial implementation of -mabicalls/-mno-abicalls.
      
      This patch implements the main rules for -mno-abicalls such as reserving $gp,
      and emitting the correct .option directive.
      
      Patch by Matheus Almeida and Toma Tabacu
      
      Differential Revision: http://reviews.llvm.org/D4231
      
      llvm-svn: 223009
      24b3307b
    • Daniel Sanders's avatar
      Merged from r214578: · b16d386b
      Daniel Sanders authored
      llvm/test/CodeGen/Mips/cconv/arguments-varargs.ll: Add explicit -mtriple=(mips|mipsel)-linux on 4 lines.
      
      llvm-svn: 223008
      b16d386b
    • Daniel Sanders's avatar
      Merged from r214493: · 4feb6fe3
      Daniel Sanders authored
      [mips][PR19612] Fix va_arg for big-endian mode.
      
      Summary:
      Big-endian mode was not correctly adjusting the offset for types smaller
      than an ABI slot.
      
      Fixes PR19612
      
      Reviewers: dsanders
      
      Reviewed By: dsanders
      
      Subscribers: sstankovic, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D4556
      
      llvm-svn: 223007
      4feb6fe3
    • Daniel Sanders's avatar
      Merged from r222339*: · 2c03fbfd
      Daniel Sanders authored
      Please note that there is a significant change to the test compared to r222339.
      This is because this branch generates different code compared to the trunk.
      The code on this branch appears to be equivalent so the test has been updated
      accordingly.
      -------------------------------------------------------------------------------
      Allow EmitVAArg() to promote types and use this to fix some N32/N64 vararg issues for Mips.
      
      Summary:
      With this patch, passing a va_list to another function and reading 10 int's from
      it works correctly on a big-endian target.
      
      Based on a pair of patches by David Chisnall, one of which I've reworked
      for the current trunk.
      
      Reviewers: theraven, atanasyan
      
      Reviewed By: theraven, atanasyan
      
      Subscribers: cfe-commits
      
      Differential Revision: http://reviews.llvm.org/D6248
      
      llvm-svn: 223005
      2c03fbfd