1// -*- mode:c++ -*- 2 3// Copyright (c) 2007 The Hewlett-Packard Development Company 4// All rights reserved. 5// 6// The license below extends only to copyright in the software and shall 7// not be construed as granting a license to any other intellectual 8// property including but not limited to intellectual property relating --- 130 unchanged lines hidden (view full) --- 139 microop.micropc = len(self.microops) 140 self.microops.append(microop) 141 def setAdjustEnv(self, val): 142 self.adjust_env = val 143 def adjustImm(self, val): 144 self.adjust_imm += val 145 def adjustDisp(self, val): 146 self.adjust_disp += val |
147 def serializeBefore(self): 148 self.serialize_before = True 149 def serializeAfter(self): 150 self.serialize_after = True |
151 152 def function_call(self): 153 self.function_call = True 154 def function_return(self): 155 self.function_return = True 156 157 def __init__(self, name): 158 super(X86Macroop, self).__init__(name) 159 self.directives = { 160 "adjust_env" : self.setAdjustEnv, 161 "adjust_imm" : self.adjustImm, 162 "adjust_disp" : self.adjustDisp, |
163 "serialize_before" : self.serializeBefore, 164 "serialize_after" : self.serializeAfter, |
165 "function_call" : self.function_call, 166 "function_return" : self.function_return 167 } 168 self.declared = False 169 self.adjust_env = "" 170 self.init_env = "" 171 self.adjust_imm = ''' 172 uint64_t adjustedImm = IMMEDIATE; 173 //This is to pacify gcc in case the immediate isn't used. 174 adjustedImm = adjustedImm; 175 ''' 176 self.adjust_disp = ''' 177 uint64_t adjustedDisp = DISPLACEMENT; 178 //This is to pacify gcc in case the displacement isn't used. 179 adjustedDisp = adjustedDisp; 180 ''' |
181 self.serialize_before = False 182 self.serialize_after = False |
183 self.function_call = False 184 self.function_return = False 185 186 def getAllocator(self, env): 187 return "new X86Macroop::%s(machInst, %s)" % \ 188 (self.name, env.getAllocator()) 189 def getMnemonic(self): 190 mnemonic = self.name.lower() --- 14 unchanged lines hidden (view full) --- 205 def getDefinition(self, env): 206 #FIXME This first parameter should be the mnemonic. I need to 207 #write some code which pulls that out 208 numMicroops = len(self.microops) 209 allocMicroops = '' 210 micropc = 0 211 for op in self.microops: 212 flags = ["IsMicroop"] |
213 if micropc == 0: 214 flags.append("IsFirstMicroop") 215 216 if self.serialize_before: 217 flags.append("IsSerializing") 218 flags.append("IsSerializeBefore") 219 |
220 if micropc == numMicroops - 1: 221 flags.append("IsLastMicroop") 222 |
223 if self.serialize_after: |
224 flags.append("IsSerializing") 225 flags.append("IsSerializeAfter") 226 227 if self.function_call: 228 flags.append("IsCall") 229 if self.function_return: 230 flags.append("IsReturn") 231 else: 232 flags.append("IsDelayedCommit") |
233 |
234 allocMicroops += \ 235 "microops[%d] = %s;\n" % \ 236 (micropc, op.getAllocator(flags)) 237 micropc += 1 238 if env.useStackSize: 239 useStackSize = "true" 240 else: 241 useStackSize = "false" --- 108 unchanged lines hidden --- |