mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-29 07:53:33 +00:00
[mips][microMIPS] Change register class for GP register
Differential Revision: http://reviews.llvm.org/D7934 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230760 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
27eab65932
commit
2846ef3680
@ -79,14 +79,19 @@ unsigned MipsFunctionInfo::getGlobalBaseReg() {
|
||||
if (GlobalBaseReg)
|
||||
return GlobalBaseReg;
|
||||
|
||||
MipsSubtarget const &STI =
|
||||
static_cast<const MipsSubtarget &>(MF.getSubtarget());
|
||||
|
||||
const TargetRegisterClass *RC =
|
||||
static_cast<const MipsSubtarget &>(MF.getSubtarget()).inMips16Mode()
|
||||
STI.inMips16Mode()
|
||||
? &Mips::CPU16RegsRegClass
|
||||
: static_cast<const MipsTargetMachine &>(MF.getTarget())
|
||||
.getABI()
|
||||
.IsN64()
|
||||
? &Mips::GPR64RegClass
|
||||
: &Mips::GPR32RegClass;
|
||||
: STI.inMicroMipsMode()
|
||||
? &Mips::GPRMM16RegClass
|
||||
: static_cast<const MipsTargetMachine &>(MF.getTarget())
|
||||
.getABI()
|
||||
.IsN64()
|
||||
? &Mips::GPR64RegClass
|
||||
: &Mips::GPR32RegClass;
|
||||
return GlobalBaseReg = MF.getRegInfo().createVirtualRegister(RC);
|
||||
}
|
||||
|
||||
|
18
test/CodeGen/Mips/micromips-gp-rc.ll
Normal file
18
test/CodeGen/Mips/micromips-gp-rc.ll
Normal file
@ -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]+}}
|
||||
|
Loading…
Reference in New Issue
Block a user