Deleted Added
sdiff udiff text old ( 7629:0f0c231e3e97 ) new ( 9913:7f43babfde6a )
full compact
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating
9 * to a hardware implementation of the functionality of the software
10 * licensed hereunder. You may use the software subject to the license
11 * terms below provided that you ensure that this notice is replicated

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

35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 *
38 * Authors: Gabe Black
39 */
40
41#include "arch/x86/insts/static_inst.hh"
42#include "arch/x86/regs/segment.hh"
43#include "cpu/reg_class.hh"
44
45namespace X86ISA
46{
47 void X86StaticInst::printMnemonic(std::ostream &os,
48 const char * mnemonic) const
49 {
50 ccprintf(os, " %s ", mnemonic);
51 }

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

126 {"", "%s", "%sx", "", "e%sx", "", "", "", "r%sx"};
127 static const char * piFormats[9] =
128 {"", "%s", "%s", "", "e%s", "", "", "", "r%s"};
129 static const char * longFormats[9] =
130 {"", "r%sb", "r%sw", "", "r%sd", "", "", "", "r%s"};
131 static const char * microFormats[9] =
132 {"", "t%db", "t%dw", "", "t%dd", "", "", "", "t%d"};
133
134 RegIndex rel_reg;
135
136 switch (regIdxToClass(reg, &rel_reg)) {
137 case IntRegClass: {
138 const char * suffix = "";
139 bool fold = rel_reg & IntFoldBit;
140 rel_reg &= ~IntFoldBit;
141
142 if(fold)
143 suffix = "h";
144 else if(rel_reg < 8 && size == 1)
145 suffix = "l";
146
147 switch (rel_reg) {
148 case INTREG_RAX:
149 ccprintf(os, abcdFormats[size], "a");
150 break;
151 case INTREG_RBX:
152 ccprintf(os, abcdFormats[size], "b");
153 break;
154 case INTREG_RCX:
155 ccprintf(os, abcdFormats[size], "c");

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

189 break;
190 case INTREG_R14W:
191 ccprintf(os, longFormats[size], "14");
192 break;
193 case INTREG_R15W:
194 ccprintf(os, longFormats[size], "15");
195 break;
196 default:
197 ccprintf(os, microFormats[size], rel_reg - NUM_INTREGS);
198 }
199 ccprintf(os, suffix);
200 break;
201 }
202
203 case FloatRegClass: {
204 if (rel_reg < NumMMXRegs) {
205 ccprintf(os, "%%mmx%d", rel_reg);
206 return;
207 }
208 rel_reg -= NumMMXRegs;
209 if (rel_reg < NumXMMRegs * 2) {
210 ccprintf(os, "%%xmm%d_%s", rel_reg / 2,
211 (rel_reg % 2) ? "high": "low");
212 return;
213 }
214 rel_reg -= NumXMMRegs * 2;
215 if (rel_reg < NumMicroFpRegs) {
216 ccprintf(os, "%%ufp%d", rel_reg);
217 return;
218 }
219 rel_reg -= NumMicroFpRegs;
220 ccprintf(os, "%%st(%d)", rel_reg);
221 break;
222 }
223
224 case MiscRegClass:
225 switch (rel_reg) {
226 default:
227 ccprintf(os, "%%ctrl%d", rel_reg);
228 }
229 break;
230 }
231 }
232
233 void X86StaticInst::printMem(std::ostream &os, uint8_t segment,
234 uint8_t scale, RegIndex index, RegIndex base,
235 uint64_t disp, uint8_t addressSize, bool rip) const
236 {
237 bool someAddr = false;

--- 43 unchanged lines hidden ---