mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-02 19:24:25 +00:00
This patch handles unaligned loads and stores in Mips JIT. Mips backend
implements unaligned loads and stores with assembler macro-instructions ulw, usw, ulh, ulhu, ush, and this patch emits corresponding instructions instead of these macros. Since each unaligned load/store is expanded into two corresponding loads/stores where offset for second load/store is modified by +3 (for words) or +1 (for halfwords). Patch by Petar Jovanovic and Sasa Stankovic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144081 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -218,10 +218,16 @@ void MipsJITInfo::relocate(void *Function, MachineRelocation *MR,
|
||||
*((unsigned*) RelocPos) |= (unsigned) ResultPtr;
|
||||
break;
|
||||
|
||||
case Mips::reloc_mips_lo:
|
||||
ResultPtr = ResultPtr & 0xffff;
|
||||
case Mips::reloc_mips_lo: {
|
||||
// Addend is needed for unaligned load/store instructions, where offset
|
||||
// for the second load/store in the expanded instruction sequence must
|
||||
// be modified by +1 or +3. Otherwise, Addend is 0.
|
||||
int Addend = *((unsigned*) RelocPos) & 0xffff;
|
||||
ResultPtr = (ResultPtr + Addend) & 0xffff;
|
||||
*((unsigned*) RelocPos) &= 0xffff0000;
|
||||
*((unsigned*) RelocPos) |= (unsigned) ResultPtr;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
llvm_unreachable("ERROR: Unknown Mips relocation.");
|
||||
|
Reference in New Issue
Block a user