base.isa (4534:7035ff1aa521) | base.isa (4539:6eeeea62b7c4) |
---|---|
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: --- 50 unchanged lines hidden (view full) --- 59 # This will be populated with mappings between microop mnemonics and 60 # the classes that represent them. 61 microopClasses = {} 62}}; 63 64//A class which is the base of all x86 micro ops. It provides a function to 65//set necessary flags appropriately. 66output header {{ | 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: --- 50 unchanged lines hidden (view full) --- 59 # This will be populated with mappings between microop mnemonics and 60 # the classes that represent them. 61 microopClasses = {} 62}}; 63 64//A class which is the base of all x86 micro ops. It provides a function to 65//set necessary flags appropriately. 66output header {{ |
67 class X86MicroOpBase : public X86StaticInst | 67 class X86MicroopBase : public X86StaticInst |
68 { 69 protected: 70 const char * instMnem; 71 uint8_t opSize; 72 uint8_t addrSize; 73 | 68 { 69 protected: 70 const char * instMnem; 71 uint8_t opSize; 72 uint8_t addrSize; 73 |
74 X86MicroOpBase(ExtMachInst _machInst, | 74 X86MicroopBase(ExtMachInst _machInst, |
75 const char *mnem, const char *_instMnem, 76 bool isMicro, bool isDelayed, 77 bool isFirst, bool isLast, 78 OpClass __opClass) : 79 X86StaticInst(mnem, _machInst, __opClass), 80 instMnem(_instMnem) 81 { | 75 const char *mnem, const char *_instMnem, 76 bool isMicro, bool isDelayed, 77 bool isFirst, bool isLast, 78 OpClass __opClass) : 79 X86StaticInst(mnem, _machInst, __opClass), 80 instMnem(_instMnem) 81 { |
82 flags[IsMicroOp] = isMicro; | 82 flags[IsMicroop] = isMicro; |
83 flags[IsDelayedCommit] = isDelayed; | 83 flags[IsDelayedCommit] = isDelayed; |
84 flags[IsFirstMicroOp] = isFirst; 85 flags[IsLastMicroOp] = isLast; | 84 flags[IsFirstMicroop] = isFirst; 85 flags[IsLastMicroop] = isLast; |
86 } 87 88 std::string generateDisassembly(Addr pc, 89 const SymbolTable *symtab) const 90 { 91 std::stringstream ss; 92 93 ccprintf(ss, "\t%s.%s", instMnem, mnemonic); --- 9 unchanged lines hidden (view full) --- 103// 104////////////////////////////////////////////////////////////////////////// 105 106let {{ 107 class X86Microop(object): 108 def __init__(self, name): 109 self.name = name 110 | 86 } 87 88 std::string generateDisassembly(Addr pc, 89 const SymbolTable *symtab) const 90 { 91 std::stringstream ss; 92 93 ccprintf(ss, "\t%s.%s", instMnem, mnemonic); --- 9 unchanged lines hidden (view full) --- 103// 104////////////////////////////////////////////////////////////////////////// 105 106let {{ 107 class X86Microop(object): 108 def __init__(self, name): 109 self.name = name 110 |
111 # This converts a python bool into a C++ bool 112 def cppBool(self, val): 113 if val: 114 return "true" 115 else: 116 return "false" 117 |
|
111 # This converts a list of python bools into 112 # a comma seperated list of C++ bools. 113 def microFlagsText(self, vals): 114 text = "" 115 for val in vals: | 118 # This converts a list of python bools into 119 # a comma seperated list of C++ bools. 120 def microFlagsText(self, vals): 121 text = "" 122 for val in vals: |
116 if val: 117 text += ", true" 118 else: 119 text += ", false" | 123 text += ", %s" % self.cppBool(val) |
120 return text 121 122 def getAllocator(self, mnemonic, *microFlags): 123 return 'new %s(machInst, %s)' % (self.className, mnemonic, self.microFlagsText(microFlags)) 124}}; 125 126////////////////////////////////////////////////////////////////////////// 127// 128// LdStOp Microop templates 129// 130////////////////////////////////////////////////////////////////////////// 131 132def template MicroLdStOpDeclare {{ | 124 return text 125 126 def getAllocator(self, mnemonic, *microFlags): 127 return 'new %s(machInst, %s)' % (self.className, mnemonic, self.microFlagsText(microFlags)) 128}}; 129 130////////////////////////////////////////////////////////////////////////// 131// 132// LdStOp Microop templates 133// 134////////////////////////////////////////////////////////////////////////// 135 136def template MicroLdStOpDeclare {{ |
133 class %(class_name)s : public X86MicroOpBase | 137 class %(class_name)s : public X86MicroopBase |
134 { 135 protected: 136 const uint8_t scale; 137 const RegIndex index; 138 const RegIndex base; 139 const uint64_t disp; 140 const uint8_t segment; 141 const RegIndex data; --- 72 unchanged lines hidden --- | 138 { 139 protected: 140 const uint8_t scale; 141 const RegIndex index; 142 const RegIndex base; 143 const uint64_t disp; 144 const uint8_t segment; 145 const RegIndex data; --- 72 unchanged lines hidden --- |