ARM: Allow flattening into any mode.
This commit is contained in:
parent
698ee26c6b
commit
a5ea52bb45
5 changed files with 46 additions and 10 deletions
|
@ -101,7 +101,7 @@ MacroMemOp::MacroMemOp(const char *mnem, ExtMachInst machInst,
|
||||||
|
|
||||||
unsigned regIdx = reg;
|
unsigned regIdx = reg;
|
||||||
if (force_user) {
|
if (force_user) {
|
||||||
regIdx = intRegForceUser(regIdx);
|
regIdx = intRegInMode(MODE_USER, regIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (load) {
|
if (load) {
|
||||||
|
|
|
@ -1,4 +1,16 @@
|
||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2010 ARM Limited
|
||||||
|
* All rights reserved
|
||||||
|
*
|
||||||
|
* The license below extends only to copyright in the software and shall
|
||||||
|
* not be construed as granting a license to any other intellectual
|
||||||
|
* property including but not limited to intellectual property relating
|
||||||
|
* to a hardware implementation of the functionality of the software
|
||||||
|
* licensed hereunder. You may use the software subject to the license
|
||||||
|
* terms below provided that you ensure that this notice is replicated
|
||||||
|
* unmodified and in its entirety in all distributions of the software,
|
||||||
|
* modified or unmodified, in source code or in binary form.
|
||||||
|
*
|
||||||
* Copyright (c) 2009 The Regents of The University of Michigan
|
* Copyright (c) 2009 The Regents of The University of Michigan
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -33,6 +45,8 @@
|
||||||
#ifndef __ARCH_ARM_INTREGS_HH__
|
#ifndef __ARCH_ARM_INTREGS_HH__
|
||||||
#define __ARCH_ARM_INTREGS_HH__
|
#define __ARCH_ARM_INTREGS_HH__
|
||||||
|
|
||||||
|
#include "arch/arm/types.hh"
|
||||||
|
|
||||||
namespace ArmISA
|
namespace ArmISA
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -322,12 +336,13 @@ INTREG_FIQ(unsigned index)
|
||||||
return IntRegFiqMap[index];
|
return IntRegFiqMap[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline IntRegIndex
|
static const unsigned intRegsPerMode = NUM_INTREGS;
|
||||||
intRegForceUser(unsigned index)
|
|
||||||
{
|
|
||||||
assert(index < NUM_ARCH_INTREGS);
|
|
||||||
|
|
||||||
return index == 15 ? (IntRegIndex)15 : (IntRegIndex)(index + NUM_INTREGS);
|
static inline int
|
||||||
|
intRegInMode(OperatingMode mode, int reg)
|
||||||
|
{
|
||||||
|
assert(reg < NUM_ARCH_INTREGS);
|
||||||
|
return mode * intRegsPerMode + reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,9 +270,27 @@ namespace ArmISA
|
||||||
} else if (reg < NUM_INTREGS) {
|
} else if (reg < NUM_INTREGS) {
|
||||||
return reg;
|
return reg;
|
||||||
} else {
|
} else {
|
||||||
reg -= NUM_INTREGS;
|
int mode = reg / intRegsPerMode;
|
||||||
assert(reg < NUM_ARCH_INTREGS);
|
reg = reg % intRegsPerMode;
|
||||||
return reg;
|
switch (mode) {
|
||||||
|
case MODE_USER:
|
||||||
|
case MODE_SYSTEM:
|
||||||
|
return INTREG_USR(reg);
|
||||||
|
case MODE_FIQ:
|
||||||
|
return INTREG_FIQ(reg);
|
||||||
|
case MODE_IRQ:
|
||||||
|
return INTREG_IRQ(reg);
|
||||||
|
case MODE_SVC:
|
||||||
|
return INTREG_SVC(reg);
|
||||||
|
case MODE_MON:
|
||||||
|
return INTREG_MON(reg);
|
||||||
|
case MODE_ABORT:
|
||||||
|
return INTREG_ABT(reg);
|
||||||
|
case MODE_UNDEFINED:
|
||||||
|
return INTREG_UND(reg);
|
||||||
|
default:
|
||||||
|
panic("Flattening into an unknown mode.\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,9 @@ def operands {{
|
||||||
maybePCRead, maybeIWPCWrite),
|
maybePCRead, maybeIWPCWrite),
|
||||||
'AIWDest': ('IntReg', 'uw', 'dest', 'IsInteger', 2,
|
'AIWDest': ('IntReg', 'uw', 'dest', 'IsInteger', 2,
|
||||||
maybePCRead, maybeAIWPCWrite),
|
maybePCRead, maybeAIWPCWrite),
|
||||||
|
'SpMode': ('IntReg', 'uw',
|
||||||
|
'intRegInMode((OperatingMode)regMode, INTREG_SP)',
|
||||||
|
'IsInteger', 2),
|
||||||
'MiscDest': ('ControlReg', 'uw', 'dest', (None, None, 'IsControl'), 2),
|
'MiscDest': ('ControlReg', 'uw', 'dest', (None, None, 'IsControl'), 2),
|
||||||
'Base': ('IntReg', 'uw', 'base', 'IsInteger', 0,
|
'Base': ('IntReg', 'uw', 'base', 'IsInteger', 0,
|
||||||
maybeAlignedPCRead, maybePCWrite),
|
maybeAlignedPCRead, maybePCWrite),
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace ArmISA {
|
||||||
using ArmISAInst::MaxInstSrcRegs;
|
using ArmISAInst::MaxInstSrcRegs;
|
||||||
using ArmISAInst::MaxInstDestRegs;
|
using ArmISAInst::MaxInstDestRegs;
|
||||||
|
|
||||||
typedef uint8_t RegIndex;
|
typedef uint16_t RegIndex;
|
||||||
|
|
||||||
typedef uint64_t IntReg;
|
typedef uint64_t IntReg;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue