macromem.cc (7175:db22937a4e0f) macromem.cc (7190:e6240d7be030)
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 53 unchanged lines hidden (view full) ---

62 uint32_t addr = 0;
63
64 if (!up)
65 addr = (ones << 2) - 4;
66
67 if (!index)
68 addr += 4;
69
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 53 unchanged lines hidden (view full) ---

62 uint32_t addr = 0;
63
64 if (!up)
65 addr = (ones << 2) - 4;
66
67 if (!index)
68 addr += 4;
69
70 StaticInstPtr *uop = microOps;
71 StaticInstPtr wbUop;
72 if (writeback) {
73 if (up) {
74 wbUop = new MicroAddiUop(machInst, rn, rn, ones * 4);
75 } else {
76 wbUop = new MicroSubiUop(machInst, rn, rn, ones * 4);
77 }
78 }
79
70 // Add 0 to Rn and stick it in ureg0.
71 // This is equivalent to a move.
80 // Add 0 to Rn and stick it in ureg0.
81 // This is equivalent to a move.
72 microOps[0] = new MicroAddiUop(machInst, INTREG_UREG0, rn, 0);
82 *uop = new MicroAddiUop(machInst, INTREG_UREG0, rn, 0);
73
83
84 // Write back at the start for loads. This covers the ldm exception return
85 // case where the base needs to be written in the old mode. Stores may need
86 // the original value of the base, but they don't change mode and can
87 // write back at the end like before.
88 if (load && writeback) {
89 *++uop = wbUop;
90 }
91
74 unsigned reg = 0;
75 bool force_user = user & !bits(reglist, 15);
76 bool exception_ret = user & bits(reglist, 15);
77
92 unsigned reg = 0;
93 bool force_user = user & !bits(reglist, 15);
94 bool exception_ret = user & bits(reglist, 15);
95
78 for (int i = 1; i < ones + 1; i++) {
96 for (int i = 0; i < ones; i++) {
79 // Find the next register.
80 while (!bits(regs, reg))
81 reg++;
82 replaceBits(regs, reg, 0);
83
84 unsigned regIdx = reg;
85 if (force_user) {
86 regIdx = intRegForceUser(regIdx);
87 }
88
89 if (load) {
90 if (reg == INTREG_PC && exception_ret) {
91 // This must be the exception return form of ldm.
97 // Find the next register.
98 while (!bits(regs, reg))
99 reg++;
100 replaceBits(regs, reg, 0);
101
102 unsigned regIdx = reg;
103 if (force_user) {
104 regIdx = intRegForceUser(regIdx);
105 }
106
107 if (load) {
108 if (reg == INTREG_PC && exception_ret) {
109 // This must be the exception return form of ldm.
92 microOps[i] =
93 new MicroLdrRetUop(machInst, regIdx,
94 INTREG_UREG0, up, addr);
110 *++uop = new MicroLdrRetUop(machInst, regIdx,
111 INTREG_UREG0, up, addr);
95 } else {
112 } else {
96 microOps[i] =
97 new MicroLdrUop(machInst, regIdx, INTREG_UREG0, up, addr);
113 *++uop = new MicroLdrUop(machInst, regIdx,
114 INTREG_UREG0, up, addr);
98 }
99 } else {
115 }
116 } else {
100 microOps[i] =
101 new MicroStrUop(machInst, regIdx, INTREG_UREG0, up, addr);
117 *++uop = new MicroStrUop(machInst, regIdx, INTREG_UREG0, up, addr);
102 }
103
104 if (up)
105 addr += 4;
106 else
107 addr -= 4;
108 }
109
118 }
119
120 if (up)
121 addr += 4;
122 else
123 addr -= 4;
124 }
125
110 StaticInstPtr &lastUop = microOps[numMicroops - 1];
111 if (writeback) {
112 if (up) {
113 lastUop = new MicroAddiUop(machInst, rn, rn, ones * 4);
114 } else {
115 lastUop = new MicroSubiUop(machInst, rn, rn, ones * 4);
116 }
126 if (!load && writeback) {
127 *++uop = wbUop;
117 }
128 }
118 lastUop->setLastMicroop();
129
130 (*uop)->setLastMicroop();
119}
120
121MacroVFPMemOp::MacroVFPMemOp(const char *mnem, ExtMachInst machInst,
122 OpClass __opClass, IntRegIndex rn,
123 RegIndex vd, bool single, bool up,
124 bool writeback, bool load, uint32_t offset) :
125 PredMacroOp(mnem, machInst, __opClass)
126{

--- 55 unchanged lines hidden ---
131}
132
133MacroVFPMemOp::MacroVFPMemOp(const char *mnem, ExtMachInst machInst,
134 OpClass __opClass, IntRegIndex rn,
135 RegIndex vd, bool single, bool up,
136 bool writeback, bool load, uint32_t offset) :
137 PredMacroOp(mnem, machInst, __opClass)
138{

--- 55 unchanged lines hidden ---