1// -*- mode:c++ -*- 2 3// Copyright (c) 2010 ARM Limited 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 --- 69 unchanged lines hidden (view full) --- 78def template LoadStoreConstructor {{ 79 inline %(class_name)s::%(class_name)s(ExtMachInst machInst) 80 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s) 81 { 82 %(constructor)s; 83 } 84}}; 85 |
86let {{ 87 def buildPUBWLCase(p, u, b, w, l): 88 return (p << 4) + (u << 3) + (b << 2) + (w << 1) + (l << 0) 89 |
90 def buildMode3Inst(p, u, i, w, type, code, mnem): 91 op = ("-", "+")[u] 92 offset = ("%s Rm", "%s hilo")[i] % op 93 ea_code = "EA = Rn %s;" % ("", offset)[p] 94 if p == 0 or w == 1: 95 code += "Rn = Rn %s;" % offset 96 newSuffix = "_P%dU%dI%dW%d" % (p, u, i, w) 97 suffix = ("Reg", "Hilo")[i] 98 return LoadStoreBase(mnem, mnem.capitalize() + newSuffix, 99 ea_code, code, mem_flags = [], inst_flags = [], 100 base_class = 'Memory' + suffix, 101 exec_template_base = type.capitalize()) 102}}; 103 |
104def format AddrMode2(imm) {{ |
105 if eval(imm): 106 imm = True 107 else: 108 imm = False 109 110 header_output = decoder_output = exec_output = "" 111 decode_block = "switch(PUBWL) {\n" 112 113 # Loop over all the values of p, u, b, w and l and build instructions and 114 # a decode block for them. 115 for p in (0, 1): 116 for u in (0, 1): 117 for b in (0, 1): 118 for w in (0, 1): |
119 post = (p == 0) 120 user = (p == 0 and w == 0) 121 writeback = (p == 0 or w == 1) 122 add = (u == 1) 123 if b == 0: 124 size = 4 125 else: 126 size = 1 127 if add: 128 addStr = "true" 129 else: 130 addStr = "false" 131 if imm: 132 newDecode = "return new %s(machInst, RD, RN," + \ 133 "%s, machInst.immed11_0);" |
134 loadClass = loadImmClassName(post, add, writeback, |
135 size, False, user) |
136 storeClass = storeImmClassName(post, add, writeback, 137 size, False, user) 138 loadDecode = newDecode % (loadClass, addStr) 139 storeDecode = newDecode % (storeClass, addStr) |
140 else: 141 newDecode = "return new %s(machInst, RD, RN, %s," + \ 142 "machInst.shiftSize," + \ 143 "machInst.shift, RM);" |
144 loadClass = loadRegClassName(post, add, writeback, |
145 size, False, user) |
146 storeClass = storeRegClassName(post, add, writeback, 147 size, False, user) 148 loadDecode = newDecode % (loadClass, addStr) 149 storeDecode = newDecode % (storeClass, addStr) 150 decode = ''' |
151 case %#x: 152 {%s} 153 break; |
154 ''' 155 decode_block += decode % \ 156 (buildPUBWLCase(p,u,b,w,1), loadDecode) 157 decode_block += decode % \ 158 (buildPUBWLCase(p,u,b,w,0), storeDecode) |
159 decode_block += ''' 160 default: 161 return new Unknown(machInst); 162 break; 163 }''' 164}}; 165 166def format AddrMode3(l0Type, l0Code, l1Type, l1Code) {{ --- 58 unchanged lines hidden --- |