From: Zoran Jovanovic Date: Fri, 27 Feb 2015 15:03:50 +0000 (+0000) Subject: [mips][microMIPS] Change register class for GP register X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71a33e2ad6413491c4ba248b01d49f9aaaa47e82;p=platform%2Fupstream%2Fllvm.git [mips][microMIPS] Change register class for GP register Differential Revision: http://reviews.llvm.org/D7934 llvm-svn: 230760 --- diff --git a/llvm/lib/Target/Mips/MipsMachineFunction.cpp b/llvm/lib/Target/Mips/MipsMachineFunction.cpp index 30b93dc..09e722d 100644 --- a/llvm/lib/Target/Mips/MipsMachineFunction.cpp +++ b/llvm/lib/Target/Mips/MipsMachineFunction.cpp @@ -79,14 +79,19 @@ unsigned MipsFunctionInfo::getGlobalBaseReg() { if (GlobalBaseReg) return GlobalBaseReg; + MipsSubtarget const &STI = + static_cast(MF.getSubtarget()); + const TargetRegisterClass *RC = - static_cast(MF.getSubtarget()).inMips16Mode() + STI.inMips16Mode() ? &Mips::CPU16RegsRegClass - : static_cast(MF.getTarget()) - .getABI() - .IsN64() - ? &Mips::GPR64RegClass - : &Mips::GPR32RegClass; + : STI.inMicroMipsMode() + ? &Mips::GPRMM16RegClass + : static_cast(MF.getTarget()) + .getABI() + .IsN64() + ? &Mips::GPR64RegClass + : &Mips::GPR32RegClass; return GlobalBaseReg = MF.getRegInfo().createVirtualRegister(RC); } diff --git a/llvm/test/CodeGen/Mips/micromips-gp-rc.ll b/llvm/test/CodeGen/Mips/micromips-gp-rc.ll new file mode 100644 index 0000000..945917a --- /dev/null +++ b/llvm/test/CodeGen/Mips/micromips-gp-rc.ll @@ -0,0 +1,18 @@ +; RUN: llc -march=mipsel -mcpu=mips32r2 -mattr=+micromips \ +; RUN: -relocation-model=pic -O3 < %s | FileCheck %s + +@g = external global i32 + +; Function Attrs: noreturn nounwind +define void @foo() #0 { +entry: + %0 = load i32* @g, align 4 + tail call void @exit(i32 signext %0) + unreachable +} + +; Function Attrs: noreturn +declare void @exit(i32 signext) + +; CHECK: move $gp, ${{[0-9]+}} +