base.isa (5083:49559a8060e8) | base.isa (5666:e7925fa8f0d6) |
---|---|
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: --- 55 unchanged lines hidden (view full) --- 64////////////////////////////////////////////////////////////////////////// 65// 66// Base class for the python representation of x86 microops 67// 68////////////////////////////////////////////////////////////////////////// 69 70let {{ 71 class X86Microop(object): | 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: --- 55 unchanged lines hidden (view full) --- 64////////////////////////////////////////////////////////////////////////// 65// 66// Base class for the python representation of x86 microops 67// 68////////////////////////////////////////////////////////////////////////// 69 70let {{ 71 class X86Microop(object): |
72 73 generatorNameTemplate = "generate_%s_%d" |
|
72 | 74 |
75 generatorTemplate = ''' 76 StaticInstPtr 77 ''' + generatorNameTemplate + '''(StaticInstPtr curMacroop) 78 { 79 static const char * mnemonic = romMnemonic; 80 static const ExtMachInst dummyExtMachInst; 81 static const EmulEnv dummyEmulEnv(0, 0, 1, 1, 1); 82 83 Macroop * macroop = dynamic_cast<Macroop *>(curMacroop.get()); 84 const ExtMachInst &machInst = 85 macroop ? macroop->getExtMachInst() : dummyExtMachInst; 86 const EmulEnv &env = 87 macroop ? macroop->getEmulEnv() : dummyEmulEnv; 88 // env may not be used in the microop's constructor. 89 RegIndex reg = env.reg; 90 reg = reg; 91 return %s; 92 } 93 ''' 94 |
|
73 def __init__(self, name): 74 self.name = name 75 76 # This converts a python bool into a C++ bool 77 def cppBool(self, val): 78 if val: 79 return "true" 80 else: --- 5 unchanged lines hidden (view full) --- 86 text = "" 87 for val in vals: 88 text += ", %s" % self.cppBool(val) 89 return text 90 91 def getAllocator(self, mnemonic, *microFlags): 92 return 'new %s(machInst, %s)' % \ 93 (self.className, mnemonic, self.microFlagsText(microFlags)) | 95 def __init__(self, name): 96 self.name = name 97 98 # This converts a python bool into a C++ bool 99 def cppBool(self, val): 100 if val: 101 return "true" 102 else: --- 5 unchanged lines hidden (view full) --- 108 text = "" 109 for val in vals: 110 text += ", %s" % self.cppBool(val) 111 return text 112 113 def getAllocator(self, mnemonic, *microFlags): 114 return 'new %s(machInst, %s)' % \ 115 (self.className, mnemonic, self.microFlagsText(microFlags)) |
116 117 def getGeneratorDef(self, micropc): 118 return self.generatorTemplate % \ 119 (self.className, micropc, \ 120 self.getAllocator(True, False, False, False)) 121 122 def getGenerator(self, micropc): 123 return self.generatorNameTemplate % (self.className, micropc) |
|
94}}; | 124}}; |