specialize.isa (4609:29b5f66fed1a) | specialize.isa (4716:68cc9f2d4f73) |
---|---|
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: --- 104 unchanged lines hidden (view full) --- 113 raise Exception, "Problem parsing operand type %s" % opTypeString 114 self.reg = match.group("reg") 115 self.tag = match.group("tag") 116 self.size = match.group("size") 117 self.rsize = match.group("rsize") 118 119 ModRMRegIndex = "(MODRM_REG | (REX_R << 3))" 120 ModRMRMIndex = "(MODRM_RM | (REX_B << 3))" | 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: --- 104 unchanged lines hidden (view full) --- 113 raise Exception, "Problem parsing operand type %s" % opTypeString 114 self.reg = match.group("reg") 115 self.tag = match.group("tag") 116 self.size = match.group("size") 117 self.rsize = match.group("rsize") 118 119 ModRMRegIndex = "(MODRM_REG | (REX_R << 3))" 120 ModRMRMIndex = "(MODRM_RM | (REX_B << 3))" |
121 InstRegIndex = "(OPCODE_OP_BOTTOM3 | (REX_B << 3))" |
|
121 122 # This function specializes the given piece of code to use a particular 123 # set of argument types described by "opTypes". 124 def specializeInst(Name, opTypes, env): 125 # print "Specializing %s with opTypes %s" % (Name, opTypes) 126 while len(opTypes): 127 # Parse the operand type string we're working with 128 opType = OpType(opTypes[0]) --- 9 unchanged lines hidden (view full) --- 138 if opType.size: 139 if opType.rsize in ("l", "h", "b"): 140 print "byte" 141 elif opType.rsize == "x": 142 print "word" 143 else: 144 print "Didn't recognize fixed register size %s!" % opType.rsize 145 Name += "_R" | 122 123 # This function specializes the given piece of code to use a particular 124 # set of argument types described by "opTypes". 125 def specializeInst(Name, opTypes, env): 126 # print "Specializing %s with opTypes %s" % (Name, opTypes) 127 while len(opTypes): 128 # Parse the operand type string we're working with 129 opType = OpType(opTypes[0]) --- 9 unchanged lines hidden (view full) --- 139 if opType.size: 140 if opType.rsize in ("l", "h", "b"): 141 print "byte" 142 elif opType.rsize == "x": 143 print "word" 144 else: 145 print "Didn't recognize fixed register size %s!" % opType.rsize 146 Name += "_R" |
147 elif opType.tag == "B": 148 # This refers to registers whose index is encoded as part of the opcode 149 Name += "_R" 150 env.addReg(InstRegIndex) |
|
146 elif opType.tag == "M": 147 # This refers to memory. The macroop constructor sets up modrm 148 # addressing. Non memory modrm settings should cause an error. 149 Name += "_M" 150 env.doModRM = True 151 elif opType.tag == None or opType.size == None: 152 raise Exception, "Problem parsing operand tag: %s" % opType.tag 153 elif opType.tag in ("C", "D", "G", "P", "S", "T", "V"): --- 29 unchanged lines hidden --- | 151 elif opType.tag == "M": 152 # This refers to memory. The macroop constructor sets up modrm 153 # addressing. Non memory modrm settings should cause an error. 154 Name += "_M" 155 env.doModRM = True 156 elif opType.tag == None or opType.size == None: 157 raise Exception, "Problem parsing operand tag: %s" % opType.tag 158 elif opType.tag in ("C", "D", "G", "P", "S", "T", "V"): --- 29 unchanged lines hidden --- |