[llvm-commits] [llvm] r173320 - in /llvm/trunk: lib/Target/Mips/MipsISelLowering.cpp lib/Target/Mips/MipsISelLowering.h test/CodeGen/Mips/hf16_1.ll

NAKAMURA Takumi geek4civic at gmail.com
Wed Jan 23 22:17:03 PST 2013


2013/1/24 Reed Kotler <rkotler at mips.com>:
> Author: rkotler
> Date: Wed Jan 23 22:24:02 2013
> New Revision: 173320
>
> URL: http://llvm.org/viewvc/llvm-project?rev=173320&view=rev
> Log:
> The next phase of Mips16 hard float implementation.
>
> Allow Mips16 routines to call Mips32 routines that have abi requirements
> that either arguments or return values are passed in floating point
> registers. This handles only the pic case. We have not done non pic
> for Mips16 yet in any form.
>
> The libm functions are Mips32, so with this addition we have a complete
> Mips16 hard float implementation.
>
> We still are not able to complete mix Mip16 and Mips32 with hard float.
> That will be the next phase which will have several steps. For Mips32
> to freely call Mips16 some stub functions must be created.
>
>
> Added:
>     llvm/trunk/test/CodeGen/Mips/hf16_1.ll
> Modified:
>     llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
>     llvm/trunk/lib/Target/Mips/MipsISelLowering.h
>
> Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=173320&r1=173319&r2=173320&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Wed Jan 23 22:24:02 2013

> +const char* MipsTargetLowering::
> +  getMips16HelperFunction
> +    (Type* RetTy, ArgListTy &Args, bool &needHelper) const {
> +  const unsigned int maxStubNum = 10;
> +  const bool validStubNum[maxStubNum+1] =
> +    {true, true, true, false, false, true, true, false, false, true, true};
> +  const unsigned int stubNum = getMips16HelperFunctionStubNumber(Args);
> +  assert(stubNum <= maxStubNum);
> +  assert (validStubNum[stubNum]);

maxStubNum and validStubNum[] were unused w/o assertions. Fixed in r173324.

> +  const char *result;
> +  if (RetTy->isFloatTy()) {
> +    result = sfMips16Helper[stubNum];
> +  }
> +  else if (RetTy ->isDoubleTy()) {
> +    result = dfMips16Helper[stubNum];
> +  }
> +  else if (RetTy->isStructTy()) {
> +    // check if it's complex
> +    if (RetTy->getNumContainedTypes() == 2) {
> +      if ((RetTy->getContainedType(0)->isFloatTy()) &&
> +          (RetTy->getContainedType(1)->isFloatTy())) {
> +        result = scMips16Helper[stubNum];
> +      }
> +      else if ((RetTy->getContainedType(0)->isDoubleTy()) &&
> +               (RetTy->getContainedType(1)->isDoubleTy())) {
> +        result = dcMips16Helper[stubNum];
> +      }
           else *1
> +    }
          else *2
> +  }
> +  else {
> +    if (stubNum == 0) {
> +      needHelper = false;
> +      return "";
> +    }
> +    result = vMips16Helper[stubNum];
> +  }
> +  needHelper = true;
> +  return result;
> +}

"result" is not set in path *1 and *2. Clang complains.
Suppressed in r173325 to put llvm_unreachable(). Please take a look.



More information about the llvm-commits mailing list