mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-21 09:25:07 +00:00
Fix bug in emitGEPOperation with large struct-member offsets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18201 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
69efbdd4f3
commit
31e575901f
@ -1059,8 +1059,18 @@ void V8ISel::emitGEPOperation (MachineBasicBlock *MBB,
|
||||
unsigned memberOffset =
|
||||
TD.getStructLayout (StTy)->MemberOffsets[fieldIndex];
|
||||
// Emit an ADD to add memberOffset to the basePtr.
|
||||
BuildMI (*MBB, IP, V8::ADDri, 2,
|
||||
nextBasePtrReg).addReg (basePtrReg).addZImm (memberOffset);
|
||||
// We might have to copy memberOffset into a register first, if it's
|
||||
// big.
|
||||
if (memberOffset + 4096 < 8191) {
|
||||
BuildMI (*MBB, IP, V8::ADDri, 2,
|
||||
nextBasePtrReg).addReg (basePtrReg).addSImm (memberOffset);
|
||||
} else {
|
||||
unsigned offsetReg = makeAnotherReg (Type::IntTy);
|
||||
copyConstantToRegister (MBB, IP,
|
||||
ConstantInt::get(Type::IntTy, memberOffset), offsetReg);
|
||||
BuildMI (*MBB, IP, V8::ADDrr, 2,
|
||||
nextBasePtrReg).addReg (basePtrReg).addReg (offsetReg);
|
||||
}
|
||||
// The next type is the member of the structure selected by the
|
||||
// index.
|
||||
Ty = StTy->getElementType (fieldIndex);
|
||||
|
@ -1059,8 +1059,18 @@ void V8ISel::emitGEPOperation (MachineBasicBlock *MBB,
|
||||
unsigned memberOffset =
|
||||
TD.getStructLayout (StTy)->MemberOffsets[fieldIndex];
|
||||
// Emit an ADD to add memberOffset to the basePtr.
|
||||
BuildMI (*MBB, IP, V8::ADDri, 2,
|
||||
nextBasePtrReg).addReg (basePtrReg).addZImm (memberOffset);
|
||||
// We might have to copy memberOffset into a register first, if it's
|
||||
// big.
|
||||
if (memberOffset + 4096 < 8191) {
|
||||
BuildMI (*MBB, IP, V8::ADDri, 2,
|
||||
nextBasePtrReg).addReg (basePtrReg).addSImm (memberOffset);
|
||||
} else {
|
||||
unsigned offsetReg = makeAnotherReg (Type::IntTy);
|
||||
copyConstantToRegister (MBB, IP,
|
||||
ConstantInt::get(Type::IntTy, memberOffset), offsetReg);
|
||||
BuildMI (*MBB, IP, V8::ADDrr, 2,
|
||||
nextBasePtrReg).addReg (basePtrReg).addReg (offsetReg);
|
||||
}
|
||||
// The next type is the member of the structure selected by the
|
||||
// index.
|
||||
Ty = StTy->getElementType (fieldIndex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user