[llvm-commits] [llvm] r137804 - in /llvm/trunk: lib/Target/Mips/MipsISelLowering.cpp lib/Target/Mips/MipsISelLowering.h lib/Target/Mips/MipsInstrFormats.td lib/Target/Mips/MipsInstrInfo.td test/CodeGen/Mips/extins.ll

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Thu Aug 18 11:33:29 PDT 2011


Hi,

> +namespace {
> +  // If I is a shifted mask, set the size (Size) and the first bit of the
> +  // mask (Pos), and return true.
> +  bool IsShiftedMask(uint64_t I, unsigned SizeInBits, uint64_t &Pos,
> +                     uint64_t &Size) {
> +    assert(SizeInBits == 32 || SizeInBits == 64);
> +    bool Is32Bits = (SizeInBits == 32);
> +
> +    if ((Is32Bits == 32 && !isShiftedMask_32(I)) ||
> +        (!Is32Bits && !isShiftedMask_64(I)))
> +      return false;
> +
> +    Size = Is32Bits ? CountPopulation_32(I) : CountPopulation_64(I);
> +    Pos = Is32Bits ? CountTrailingZeros_32(I) : CountTrailingZeros_64(I);
> +    return true;
> +  }
> +}
> +

Inspired by Chris recent reply:
Please use static for functions, not anonymous namespaces.
http://llvm.org/docs/CodingStandards.html#micro_anonns

-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc




More information about the llvm-commits mailing list