ErrorOr<MipsAbiFlags> MipsAbiInfoHandler<ELFT>::createAbiFromHeaderFlags(uint32_t flags) { MipsAbiFlags abi; ErrorOr<MipsISAs> isa = headerFlagsToIsa(flags); if (auto ec = isa.getError()) return ec; abi._isa = *isa; abi._fpAbi = Val_GNU_MIPS_ABI_FP_ANY; abi._cpr1Size = AFL_REG_NONE; abi._cpr2Size = AFL_REG_NONE; abi._gprSize = is32BitElfFlags(flags) ? AFL_REG_32 : AFL_REG_64; ErrorOr<uint32_t> ases = flagsToAses(flags); if (auto ec = ases.getError()) return ec; abi._ases = *ases; abi._flags1 = 0; abi._abi = flags & EF_MIPS_ABI; abi._isPic = flags & EF_MIPS_PIC; abi._isCPic = flags & EF_MIPS_CPIC; abi._isNoReorder = flags & EF_MIPS_NOREORDER; abi._is32BitMode = flags & EF_MIPS_32BITMODE; abi._isNan2008 = flags & EF_MIPS_NAN2008; return abi; }
bool MipsAbiFlags::fillByElfFlags(const Input& pInput, uint64_t elfFlags, MipsAbiFlags& mipsAbi) { mipsAbi.m_IsaLevel = getIsaLevel(elfFlags); mipsAbi.m_IsaRev = getIsaRev(elfFlags); mipsAbi.m_IsaExt = getIsaExt(elfFlags); mipsAbi.m_GprSize = is32BitElfFlags(elfFlags) ? llvm::Mips::AFL_REG_32 : llvm::Mips::AFL_REG_64; mipsAbi.m_Cpr1Size = llvm::Mips::AFL_REG_NONE; mipsAbi.m_Cpr2Size = llvm::Mips::AFL_REG_NONE; mipsAbi.m_FpAbi = llvm::Mips::Val_GNU_MIPS_ABI_FP_ANY; mipsAbi.m_Ases = 0; if (elfFlags & llvm::ELF::EF_MIPS_MICROMIPS) mipsAbi.m_Ases |= llvm::Mips::AFL_ASE_MICROMIPS; if (elfFlags & llvm::ELF::EF_MIPS_ARCH_ASE_M16) mipsAbi.m_Ases |= llvm::Mips::AFL_ASE_MIPS16; if (elfFlags & llvm::ELF::EF_MIPS_ARCH_ASE_MDMX) mipsAbi.m_Ases |= llvm::Mips::AFL_ASE_MDMX; mipsAbi.m_Flags1 = 0; return true; }