Deleted Added
sdiff udiff text old ( 5046:da031ef02439 ) new ( 5161:e7334f2d7bef )
full compact
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:

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

137
138// Basic instruction class constructor template.
139def template MacroConstructor {{
140 inline X86Macroop::%(class_name)s::%(class_name)s(
141 ExtMachInst machInst, EmulEnv env)
142 : %(base_class)s("%(mnemonic)s", machInst, %(num_microops)s)
143 {
144 %(adjust_env)s;
145 %(do_modrm)s;
146 %(constructor)s;
147 //alloc_microops is the code that sets up the microops
148 //array in the parent class.
149 %(alloc_microops)s;
150 }
151}};
152
153let {{
154 from micro_asm import Combinational_Macroop, Rom_Macroop
155 class X86Macroop(Combinational_Macroop):
156 def add_microop(self, mnemonic, microop):
157 microop.mnemonic = mnemonic
158 microop.micropc = len(self.microops)
159 self.microops.append(microop)
160 def setAdjustEnv(self, val):
161 self.adjust_env = val
162 def __init__(self, name):
163 super(X86Macroop, self).__init__(name)
164 self.directives = {
165 "adjust_env" : self.setAdjustEnv
166 }
167 self.declared = False
168 self.adjust_env = ""
169 self.doModRM = ""
170 def getAllocator(self, env):
171 return "new X86Macroop::%s(machInst, %s)" % (self.name, env.getAllocator())
172 def getDeclaration(self):
173 #FIXME This first parameter should be the mnemonic. I need to
174 #write some code which pulls that out
175 declareLabels = ""
176 for (label, microop) in self.labels.items():
177 declareLabels += "const static uint64_t label_%s = %d;\n" \

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

193 (micropc, op.getAllocator(True, False,
194 micropc == 0,
195 micropc == numMicroops - 1))
196 micropc += 1
197 iop = InstObjParams(self.name, self.name, "Macroop",
198 {"code" : "", "num_microops" : numMicroops,
199 "alloc_microops" : allocMicroops,
200 "adjust_env" : self.adjust_env,
201 "do_modrm" : self.doModRM})
202 return MacroConstructor.subst(iop);
203}};
204
205let {{
206 class EmulEnv(object):
207 def __init__(self):
208 self.reg = "0"

--- 71 unchanged lines hidden ---