automerge

This commit is contained in:
Nathan Binkert 2009-11-08 20:15:54 -08:00
commit b1a1f9aec8
5 changed files with 63 additions and 86 deletions

View file

@ -132,15 +132,15 @@ class PySource(SourceFile):
modpath = '.'.join(modpath) modpath = '.'.join(modpath)
arcpath = path + [ self.basename ] arcpath = path + [ self.basename ]
debugname = self.snode.abspath abspath = self.snode.abspath
if not exists(debugname): if not exists(abspath):
debugname = self.tnode.abspath abspath = self.tnode.abspath
self.package = package self.package = package
self.modname = modname self.modname = modname
self.modpath = modpath self.modpath = modpath
self.arcname = joinpath(*arcpath) self.arcname = joinpath(*arcpath)
self.debugname = debugname self.abspath = abspath
self.compiled = File(self.filename + 'c') self.compiled = File(self.filename + 'c')
self.assembly = File(self.filename + '.s') self.assembly = File(self.filename + '.s')
self.symname = "PyEMB_" + PySource.invalid_sym_char.sub('_', modpath) self.symname = "PyEMB_" + PySource.invalid_sym_char.sub('_', modpath)
@ -339,9 +339,9 @@ class DictImporter(object):
source = self.modules[fullname] source = self.modules[fullname]
if source.modname == '__init__': if source.modname == '__init__':
mod.__path__ = source.modpath mod.__path__ = source.modpath
mod.__file__ = source.snode.abspath mod.__file__ = source.abspath
exec file(source.snode.abspath, 'r') in mod.__dict__ exec file(source.abspath, 'r') in mod.__dict__
return mod return mod
@ -892,7 +892,7 @@ def objectifyPyFile(target, source, env):
dst = file(str(target[0]), 'w') dst = file(str(target[0]), 'w')
pysource = PySource.tnodes[source[0]] pysource = PySource.tnodes[source[0]]
compiled = compile(src, pysource.debugname, 'exec') compiled = compile(src, pysource.abspath, 'exec')
marshalled = marshal.dumps(compiled) marshalled = marshal.dumps(compiled)
compressed = zlib.compress(marshalled) compressed = zlib.compress(marshalled)
data = compressed data = compressed

View file

@ -90,27 +90,14 @@ class ArmMacroMemoryOp : public PredMacroOp
uint32_t reglist; uint32_t reglist;
uint32_t ones; uint32_t ones;
uint32_t puswl,
prepost,
up,
psruser,
writeback,
loadop;
ArmMacroMemoryOp(const char *mnem, ExtMachInst _machInst, ArmMacroMemoryOp(const char *mnem, ExtMachInst _machInst,
OpClass __opClass) OpClass __opClass)
: PredMacroOp(mnem, _machInst, __opClass), : PredMacroOp(mnem, _machInst, __opClass), memAccessFlags(0),
memAccessFlags(0), reglist(machInst.regList), ones(0)
reglist(machInst.regList), ones(0),
puswl(machInst.puswl),
prepost(machInst.puswl.prepost),
up(machInst.puswl.up),
psruser(machInst.puswl.psruser),
writeback(machInst.puswl.writeback),
loadop(machInst.puswl.loadOp)
{ {
ones = number_of_ones(reglist); ones = number_of_ones(reglist);
numMicroops = ones + writeback + 1; numMicroops = ones + machInst.puswl.writeback + 1;
// Remember that writeback adds a uop // Remember that writeback adds a uop
microOps = new StaticInstPtr[numMicroops]; microOps = new StaticInstPtr[numMicroops];
} }

View file

@ -324,6 +324,13 @@ INTREG_FIQ(unsigned index)
return IntRegFiqMap[index]; return IntRegFiqMap[index];
} }
static inline IntRegIndex
intRegForceUser(unsigned index)
{
assert(index < NUM_ARCH_INTREGS);
return (IntRegIndex)(index + NUM_INTREGS);
}
} }
#endif #endif

View file

@ -125,8 +125,11 @@ namespace ArmISA
assert(reg >= 0); assert(reg >= 0);
if (reg < NUM_ARCH_INTREGS) { if (reg < NUM_ARCH_INTREGS) {
return intRegMap[reg]; return intRegMap[reg];
} else if (reg < NUM_INTREGS) {
return reg;
} else { } else {
assert(reg < NUM_INTREGS); reg -= NUM_INTREGS;
assert(reg < NUM_ARCH_INTREGS);
return reg; return reg;
} }
} }

View file

@ -178,75 +178,55 @@ inline %(class_name)s::%(class_name)s(ExtMachInst machInst)
: %(base_class)s("%(mnemonic)s", machInst, %(op_class)s) : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s)
{ {
%(constructor)s; %(constructor)s;
uint32_t regs_to_handle = reglist; uint32_t regs = reglist;
uint32_t start_addr = 0; uint32_t addr = 0;
bool up = machInst.puswl.up;
switch (puswl) if (!up)
{ addr = (ones << 2) - 4;
case 0x00: // stmda
case 0x01: // L ldmda_l if (machInst.puswl.prepost)
case 0x02: // W stmda_w addr += 4;
case 0x03: // WL ldmda_wl
start_addr = (ones << 2) - 4;
break;
case 0x08: // U stmia_u
case 0x09: // U L ldmia_ul
case 0x0a: // U W stmia
case 0x0b: // U WL ldmia
start_addr = 0;
break;
case 0x10: // P stmdb
case 0x11: // P L ldmdb
case 0x12: // P W stmdb
case 0x13: // P WL ldmdb
start_addr = (ones << 2); // U-bit is already 0 for subtract
break;
case 0x18: // PU stmib
case 0x19: // PU L ldmib
case 0x1a: // PU W stmib
case 0x1b: // PU WL ldmib
start_addr = 4;
break;
default:
panic("Unhandled Load/Store Multiple Instruction, "
"puswl = 0x%x", (unsigned) puswl);
break;
}
// Add 0 to Rn and stick it in ureg0. // Add 0 to Rn and stick it in ureg0.
// This is equivalent to a move. // This is equivalent to a move.
microOps[0] = new MicroAddiUop(machInst, INTREG_UREG0, RN, 0); microOps[0] = new MicroAddiUop(machInst, INTREG_UREG0, RN, 0);
unsigned j = 0; unsigned reg = 0;
for (int i = 1; i < ones + 1; i++) { for (int i = 1; i < ones + 1; i++) {
// Get next available bit for transfer // Find the next register.
while (! ( regs_to_handle & (1<<j))) while (!bits(regs, reg))
j++; reg++;
regs_to_handle &= ~(1<<j); replaceBits(regs, reg, 0);
if (loadop) unsigned regIdx = reg;
microOps[i] = new MicroLdrUop(machInst, j, if (machInst.puswl.psruser) {
INTREG_UREG0, start_addr); regIdx = intRegForceUser(regIdx);
else }
microOps[i] = new MicroStrUop(machInst, j,
INTREG_UREG0, start_addr); if (machInst.puswl.loadOp) {
microOps[i] =
new MicroLdrUop(machInst, regIdx, INTREG_UREG0, addr);
} else {
microOps[i] =
new MicroStrUop(machInst, regIdx, INTREG_UREG0, addr);
}
if (up) if (up)
start_addr += 4; addr += 4;
else else
start_addr -= 4; addr -= 4;
} }
if (writeback) { StaticInstPtr &lastUop = microOps[numMicroops - 1];
if (machInst.puswl.writeback) {
if (up) { if (up) {
microOps[numMicroops-1] = lastUop = new MicroAddiUop(machInst, RN, RN, ones * 4);
new MicroAddiUop(machInst, RN, RN, ones * 4);
} else { } else {
microOps[numMicroops-1] = lastUop = new MicroSubiUop(machInst, RN, RN, ones * 4);
new MicroSubiUop(machInst, RN, RN, ones * 4);
} }
} }
microOps[numMicroops-1]->setLastMicroop(); lastUop->setLastMicroop();
} }
}}; }};