1// Copyright (c) 2008 The Hewlett-Packard Development Company 2// All rights reserved. 3// 4// Redistribution and use of this software in source and binary forms, 5// with or without modification, are permitted provided that the 6// following conditions are met: 7// 8// The software must be used only for Non-Commercial Use which means any --- 155 unchanged lines hidden (view full) --- 164 printMnemonic(response, instMnem, mnemonic); 165 ccprintf(response, "%#x", target); 166 167 return response.str(); 168 } 169}}; 170 171let {{ |
172 class SeqOp(X86Microop): |
173 def __init__(self, target, flags=None): 174 self.target = target 175 if flags: 176 if not isinstance(flags, (list, tuple)): 177 raise Exception, "flags must be a list or tuple of flags" 178 self.cond = " | ".join(flags) 179 self.className += "Flags" 180 else: 181 self.cond = "0" 182 183 def getAllocator(self, *microFlags): 184 allocator = '''new %(class_name)s(machInst, mnemonic 185 %(flags)s, %(target)s, %(cc)s)''' % { 186 "class_name" : self.className, 187 "flags" : self.microFlagsText(microFlags), 188 "target" : self.target, 189 "cc" : self.cond} 190 return allocator 191 |
192 class Br(SeqOp): 193 className = "MicroBranch" 194 195 def getAllocator(self, *microFlags): 196 (is_micro, is_delayed, is_first, is_last) = microFlags 197 is_last = False 198 microFlags = (is_micro, is_delayed, is_first, is_last) 199 return super(Br, self).getAllocator(*microFlags) 200 |
201 iop = InstObjParams("br", "MicroBranchFlags", "SeqOpBase", 202 {"code": "nuIP = target", 203 "else_code": "nuIP = nuIP", 204 "cond_test": "checkCondition(ccFlagBits, cc)"}) 205 exec_output += SeqOpExecute.subst(iop) 206 header_output += SeqOpDeclare.subst(iop) 207 decoder_output += SeqOpConstructor.subst(iop) 208 iop = InstObjParams("br", "MicroBranch", "SeqOpBase", 209 {"code": "nuIP = target", 210 "else_code": "nuIP = nuIP", 211 "cond_test": "true"}) 212 exec_output += SeqOpExecute.subst(iop) 213 header_output += SeqOpDeclare.subst(iop) 214 decoder_output += SeqOpConstructor.subst(iop) 215 microopClasses["br"] = Br 216}}; |