specialize.isa (5788:6d4161a36ca1) specialize.isa (6518:1ad4a7774b3c)
1// -*- mode:c++ -*-
2
3// Copyright (c) 2007 The Hewlett-Packard Development Company
4// All rights reserved.
5//
6// Redistribution and use of this software in source and binary forms,
7// with or without modification, are permitted provided that the
8// following conditions are met:

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

185 env.addToDisassembly(
186 "printSegment(out, %s);\n" % ModRMRegIndex)
187 Name += "_S"
188 elif opType.tag in ("G", "P", "T", "V"):
189 # Use the "reg" field of the ModRM byte to select the register
190 env.addReg(ModRMRegIndex)
191 env.addToDisassembly(
192 "printReg(out, %s, regSize);\n" % ModRMRegIndex)
1// -*- mode:c++ -*-
2
3// Copyright (c) 2007 The Hewlett-Packard Development Company
4// All rights reserved.
5//
6// Redistribution and use of this software in source and binary forms,
7// with or without modification, are permitted provided that the
8// following conditions are met:

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

185 env.addToDisassembly(
186 "printSegment(out, %s);\n" % ModRMRegIndex)
187 Name += "_S"
188 elif opType.tag in ("G", "P", "T", "V"):
189 # Use the "reg" field of the ModRM byte to select the register
190 env.addReg(ModRMRegIndex)
191 env.addToDisassembly(
192 "printReg(out, %s, regSize);\n" % ModRMRegIndex)
193 Name += "_R"
193 if opType.tag == "P":
194 Name += "_MMX"
195 elif opType.tag == "V":
196 Name += "_XMM"
197 else:
198 Name += "_R"
194 elif opType.tag in ("E", "Q", "W"):
195 # This might refer to memory or to a register. We need to
196 # divide it up farther.
197 regEnv = copy.copy(env)
198 regEnv.addReg(ModRMRMIndex)
199 regEnv.addToDisassembly(
200 "printReg(out, %s, regSize);\n" % ModRMRMIndex)
201 # This refers to memory. The macroop constructor should set up
202 # modrm addressing.
203 memEnv = copy.copy(env)
204 memEnv.doModRM = True
199 elif opType.tag in ("E", "Q", "W"):
200 # This might refer to memory or to a register. We need to
201 # divide it up farther.
202 regEnv = copy.copy(env)
203 regEnv.addReg(ModRMRMIndex)
204 regEnv.addToDisassembly(
205 "printReg(out, %s, regSize);\n" % ModRMRMIndex)
206 # This refers to memory. The macroop constructor should set up
207 # modrm addressing.
208 memEnv = copy.copy(env)
209 memEnv.doModRM = True
210 regSuffix = "_R"
211 if opType.tag == "Q":
212 regSuffix = "_MMX"
213 elif opType.tag == "W":
214 regSuffix = "_XMM"
205 return doSplitDecode("MODRM_MOD",
215 return doSplitDecode("MODRM_MOD",
206 {"3" : (specializeInst, Name + "_R", copy.copy(opTypes), regEnv)},
207 (doRipRelativeDecode, Name, copy.copy(opTypes), memEnv))
216 {"3" : (specializeInst, Name + regSuffix,
217 copy.copy(opTypes), regEnv)},
218 (doRipRelativeDecode, Name,
219 copy.copy(opTypes), memEnv))
208 elif opType.tag in ("I", "J"):
209 # Immediates
210 env.addToDisassembly(
211 "ccprintf(out, \"%#x\", machInst.immediate);\n")
212 Name += "_I"
213 elif opType.tag == "O":
214 # Immediate containing a memory offset
215 Name += "_MI"
216 elif opType.tag in ("PR", "R", "VR"):
217 # Non register modrm settings should cause an error
218 env.addReg(ModRMRMIndex)
219 env.addToDisassembly(
220 "printReg(out, %s, regSize);\n" % ModRMRMIndex)
220 elif opType.tag in ("I", "J"):
221 # Immediates
222 env.addToDisassembly(
223 "ccprintf(out, \"%#x\", machInst.immediate);\n")
224 Name += "_I"
225 elif opType.tag == "O":
226 # Immediate containing a memory offset
227 Name += "_MI"
228 elif opType.tag in ("PR", "R", "VR"):
229 # Non register modrm settings should cause an error
230 env.addReg(ModRMRMIndex)
231 env.addToDisassembly(
232 "printReg(out, %s, regSize);\n" % ModRMRMIndex)
221 Name += "_R"
233 if opType.tag == "PR":
234 Name += "_MMX"
235 elif opType.tag == "VR":
236 Name += "_XMM"
237 else:
238 Name += "_R"
222 elif opType.tag in ("X", "Y"):
223 # This type of memory addressing is for string instructions.
224 # They'll use the right index and segment internally.
225 if opType.tag == "X":
226 env.addToDisassembly(
227 '''printMem(out, env.seg,
228 1, X86ISA::ZeroReg, X86ISA::INTREG_RSI, 0,
229 env.addressSize, false);''')

--- 13 unchanged lines hidden ---
239 elif opType.tag in ("X", "Y"):
240 # This type of memory addressing is for string instructions.
241 # They'll use the right index and segment internally.
242 if opType.tag == "X":
243 env.addToDisassembly(
244 '''printMem(out, env.seg,
245 1, X86ISA::ZeroReg, X86ISA::INTREG_RSI, 0,
246 env.addressSize, false);''')

--- 13 unchanged lines hidden ---