Lines Matching +full:- +full:replace
2 # Test tool to compare Capstone output with llvm-mc. By Nguyen Anh Quynh, 2014
12 if i == -1: # no more hex number
21 a = a.replace(hexnum, str(num))
34 if i != -1:
39 if i != -1:
42 text = text.replace('{ ', '{')
43 text = text.replace(' }', '}')
49 …p = Popen(['llvm-mc', '-disassemble', '-print-imm-hex', '-mattr=+msa', syntax] + option, stdout=PI…
51 …p = Popen(['llvm-mc', '-disassemble', '-print-imm-hex', syntax] + option, stdout=PIPE, stdin=PIPE,…
54 …p = Popen(['llvm-mc', '-disassemble', '-print-imm-hex', '-mattr=+msa'] + option, stdout=PIPE, stdi…
56 …p = Popen(['llvm-mc', '-disassemble', '-print-imm-hex'] + option, stdout=PIPE, stdin=PIPE, stderr=…
61 #print 'invalid ----'
82 mode = mode.replace(' ', '')
129 ("CS_ARCH_X86", "CS_MODE_32"): ['-triple=i386'],
130 ("CS_ARCH_X86", "CS_MODE_64"): ['-triple=x86_64'],
131 ("CS_ARCH_ARM", "CS_MODE_ARM"): ['-triple=armv7'],
132 ("CS_ARCH_ARM", "CS_MODE_THUMB"): ['-triple=thumbv7'],
133 ("CS_ARCH_ARM", "CS_MODE_ARM+CS_MODE_V8"): ['-triple=armv8'],
134 ("CS_ARCH_ARM", "CS_MODE_THUMB+CS_MODE_V8"): ['-triple=thumbv8'],
135 ("CS_ARCH_ARM", "CS_MODE_THUMB+CS_MODE_MCLASS"): ['-triple=thumbv7m'],
136 ("CS_ARCH_ARM64", "0"): ['-triple=aarch64'],
137 ("CS_ARCH_MIPS", "CS_MODE_MIPS32+CS_MODE_BIG_ENDIAN"): ['-triple=mips'],
138 ("CS_ARCH_MIPS", "CS_MODE_MIPS32+CS_MODE_MICRO"): ['-triple=mipsel', '-mattr=+micromips'],
139 ("CS_ARCH_MIPS", "CS_MODE_MIPS64"): ['-triple=mips64el'],
140 ("CS_ARCH_MIPS", "CS_MODE_MIPS32"): ['-triple=mipsel'],
141 ("CS_ARCH_MIPS", "CS_MODE_MIPS64+CS_MODE_BIG_ENDIAN"): ['-triple=mips64'],
142 …("CS_ARCH_MIPS", "CS_MODE_MIPS32+CS_MODE_MICRO+CS_MODE_BIG_ENDIAN"): ['-triple=mips', '-mattr=+mic…
143 …("CS_ARCH_MIPS", "CS_MODE_MIPS32+CS_MODE_BIG_ENDIAN+CS_MODE_MICRO"): ['-triple=mips', '-mattr=+mic…
144 ("CS_ARCH_PPC", "CS_MODE_BIG_ENDIAN"): ['-triple=powerpc64'],
145 ('CS_ARCH_SPARC', 'CS_MODE_BIG_ENDIAN'): ['-triple=sparc'],
146 ('CS_ARCH_SPARC', 'CS_MODE_BIG_ENDIAN+CS_MODE_V9'): ['-triple=sparcv9'],
147 ('CS_ARCH_SYSZ', '0'): ['-triple=s390x', '-mcpu=z196'],
158 # tell llvm-mc to use Intel syntax
159 mc_option = '-output-asm-variant=1'
174 hex_code = code.replace('0x', '')
175 hex_code = hex_code.replace(',', '')
189 cs_output2 = cs_output2.replace(' ', '')
193 cs_output2 = cs_output2.replace('$at', '$1')
194 cs_output2 = cs_output2.replace('$v0', '$2')
195 cs_output2 = cs_output2.replace('$v1', '$3')
197 cs_output2 = cs_output2.replace('$a0', '$4')
198 cs_output2 = cs_output2.replace('$a1', '$5')
199 cs_output2 = cs_output2.replace('$a2', '$6')
200 cs_output2 = cs_output2.replace('$a3', '$7')
202 cs_output2 = cs_output2.replace('$t0', '$8')
203 cs_output2 = cs_output2.replace('$t1', '$9')
204 cs_output2 = cs_output2.replace('$t2', '$10')
205 cs_output2 = cs_output2.replace('$t3', '$11')
206 cs_output2 = cs_output2.replace('$t4', '$12')
207 cs_output2 = cs_output2.replace('$t5', '$13')
208 cs_output2 = cs_output2.replace('$t6', '$14')
209 cs_output2 = cs_output2.replace('$t7', '$15')
210 cs_output2 = cs_output2.replace('$t8', '$24')
211 cs_output2 = cs_output2.replace('$t9', '$25')
213 cs_output2 = cs_output2.replace('$s0', '$16')
214 cs_output2 = cs_output2.replace('$s1', '$17')
215 cs_output2 = cs_output2.replace('$s2', '$18')
216 cs_output2 = cs_output2.replace('$s3', '$19')
217 cs_output2 = cs_output2.replace('$s4', '$20')
218 cs_output2 = cs_output2.replace('$s5', '$21')
219 cs_output2 = cs_output2.replace('$s6', '$22')
220 cs_output2 = cs_output2.replace('$s7', '$23')
222 cs_output2 = cs_output2.replace('$k0', '$26')
223 cs_output2 = cs_output2.replace('$k1', '$27')
226 if fname.endswith('thumb-fp-armv8.s.cs'):
227 mc_output = run_mc(archs[arch], code, ['-triple=thumbv8'], mc_option)
228 elif fname.endswith('mips64-alu-instructions.s.cs'):
229 mc_output = run_mc(archs[arch], code, ['-triple=mips64el', '-mcpu=mips64r2'], mc_option)
235 mc_output2 = mc_output2.replace(' 0(', '(')
238 mc_output2 = mc_output2.replace('.+', '')
239 mc_output2 = mc_output2.replace('.', '')
240 mc_output2 = mc_output2.replace(' 0(', '(')
242 mc_output2 = mc_output2.replace(' ', '')
243 mc_output2 = mc_output2.replace('opaque', '')
247 asm = asm.replace(' ', '').strip().lower()
260 #print("Usage: ./test_mc.py <input-file.s.cs>")