isa_parser.py (6989:73afd9458692) | isa_parser.py (6990:83759f72c7de) |
---|---|
1# Copyright (c) 2003-2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 879 unchanged lines hidden (view full) --- 888 # groups are returned (base and ext, not full name as above). 889 # Used for subtituting '_' for '.' to make C++ identifiers. 890 operandsWithExtREString = (r'(?<![\w\.])(%s)\.(\w+)(?![\w\.])' 891 % string.join(operands, '|')) 892 893 global operandsWithExtRE 894 operandsWithExtRE = re.compile(operandsWithExtREString, re.MULTILINE) 895 | 1# Copyright (c) 2003-2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 879 unchanged lines hidden (view full) --- 888 # groups are returned (base and ext, not full name as above). 889 # Used for subtituting '_' for '.' to make C++ identifiers. 890 operandsWithExtREString = (r'(?<![\w\.])(%s)\.(\w+)(?![\w\.])' 891 % string.join(operands, '|')) 892 893 global operandsWithExtRE 894 operandsWithExtRE = re.compile(operandsWithExtREString, re.MULTILINE) 895 |
896maxInstSrcRegs = 0 897maxInstDestRegs = 0 898 | |
899class OperandList(object): 900 '''Find all the operands in the given code block. Returns an operand 901 descriptor list (instance of class OperandList).''' 902 def __init__(self, code): 903 self.items = [] 904 self.bases = {} 905 # delete comments so we don't match on reg specifiers inside 906 code = commentRE.sub('', code) --- 45 unchanged lines hidden (view full) --- 952 if op_desc.isFloatReg(): 953 self.numFPDestRegs += 1 954 elif op_desc.isIntReg(): 955 self.numIntDestRegs += 1 956 elif op_desc.isMem(): 957 if self.memOperand: 958 error("Code block has more than one memory operand.") 959 self.memOperand = op_desc | 896class OperandList(object): 897 '''Find all the operands in the given code block. Returns an operand 898 descriptor list (instance of class OperandList).''' 899 def __init__(self, code): 900 self.items = [] 901 self.bases = {} 902 # delete comments so we don't match on reg specifiers inside 903 code = commentRE.sub('', code) --- 45 unchanged lines hidden (view full) --- 949 if op_desc.isFloatReg(): 950 self.numFPDestRegs += 1 951 elif op_desc.isIntReg(): 952 self.numIntDestRegs += 1 953 elif op_desc.isMem(): 954 if self.memOperand: 955 error("Code block has more than one memory operand.") 956 self.memOperand = op_desc |
960 global maxInstSrcRegs 961 global maxInstDestRegs 962 if maxInstSrcRegs < self.numSrcRegs: 963 maxInstSrcRegs = self.numSrcRegs 964 if maxInstDestRegs < self.numDestRegs: 965 maxInstDestRegs = self.numDestRegs | 957 if parser.maxInstSrcRegs < self.numSrcRegs: 958 parser.maxInstSrcRegs = self.numSrcRegs 959 if parser.maxInstDestRegs < self.numDestRegs: 960 parser.maxInstDestRegs = self.numDestRegs |
966 # now make a final pass to finalize op_desc fields that may depend 967 # on the register enumeration 968 for op_desc in self.items: 969 op_desc.finalize() 970 971 def __len__(self): 972 return len(self.items) 973 --- 258 unchanged lines hidden (view full) --- 1232 # The format stack. 1233 self.formatStack = Stack(NoFormat()) 1234 1235 # The default case stack. 1236 self.defaultStack = Stack(None) 1237 1238 self.exportContext = {} 1239 | 961 # now make a final pass to finalize op_desc fields that may depend 962 # on the register enumeration 963 for op_desc in self.items: 964 op_desc.finalize() 965 966 def __len__(self): 967 return len(self.items) 968 --- 258 unchanged lines hidden (view full) --- 1227 # The format stack. 1228 self.formatStack = Stack(NoFormat()) 1229 1230 # The default case stack. 1231 self.defaultStack = Stack(None) 1232 1233 self.exportContext = {} 1234 |
1235 self.maxInstSrcRegs = 0 1236 self.maxInstDestRegs = 0 1237 |
|
1240 ##################################################################### 1241 # 1242 # Lexer 1243 # 1244 # The PLY lexer module takes two things as input: 1245 # - A list of token names (the string list 'tokens') 1246 # - A regular expression describing a match for each token. The 1247 # regexp for token FOO can be provided in two ways: --- 796 unchanged lines hidden (view full) --- 2044 global_output = global_code.exec_output[cpu.name] 2045 namespace_output = namespace_code.exec_output[cpu.name] 2046 decode_function = '' 2047 self.update_if_needed(cpu.filename, file_template % vars()) 2048 2049 # The variable names here are hacky, but this will creat local 2050 # variables which will be referenced in vars() which have the 2051 # value of the globals. | 1238 ##################################################################### 1239 # 1240 # Lexer 1241 # 1242 # The PLY lexer module takes two things as input: 1243 # - A list of token names (the string list 'tokens') 1244 # - A regular expression describing a match for each token. The 1245 # regexp for token FOO can be provided in two ways: --- 796 unchanged lines hidden (view full) --- 2042 global_output = global_code.exec_output[cpu.name] 2043 namespace_output = namespace_code.exec_output[cpu.name] 2044 decode_function = '' 2045 self.update_if_needed(cpu.filename, file_template % vars()) 2046 2047 # The variable names here are hacky, but this will creat local 2048 # variables which will be referenced in vars() which have the 2049 # value of the globals. |
2052 global maxInstSrcRegs 2053 MaxInstSrcRegs = maxInstSrcRegs 2054 global maxInstDestRegs 2055 MaxInstDestRegs = maxInstDestRegs | 2050 MaxInstSrcRegs = self.maxInstSrcRegs 2051 MaxInstDestRegs = self.maxInstDestRegs |
2056 # max_inst_regs.hh 2057 self.update_if_needed('max_inst_regs.hh', 2058 max_inst_regs_template % vars()) 2059 2060 def parse_isa_desc(self, *args, **kwargs): 2061 try: 2062 self._parse_isa_desc(*args, **kwargs) 2063 except ISAParserError, e: --- 12 unchanged lines hidden --- | 2052 # max_inst_regs.hh 2053 self.update_if_needed('max_inst_regs.hh', 2054 max_inst_regs_template % vars()) 2055 2056 def parse_isa_desc(self, *args, **kwargs): 2057 try: 2058 self._parse_isa_desc(*args, **kwargs) 2059 except ISAParserError, e: --- 12 unchanged lines hidden --- |