2 Script to disassembles a bitcode file and run FileCheck on the output with the
3 provided arguments. The first 2 arguments are the paths to the llvm-dis and
4 FileCheck binaries, followed by arguments to be passed to FileCheck. The last
5 argument is the bitcode file to disassemble.
8 python llvm-dis-and-filecheck.py
9 <path to llvm-dis> <path to FileCheck>
10 [arguments passed to FileCheck] <path to bitcode file>
18 llvm_dis
= sys
.argv
[1]
19 filecheck
= sys
.argv
[2]
20 filecheck_args
= [filecheck
, ]
21 filecheck_args
.extend(sys
.argv
[3:-1])
22 bitcode_file
= sys
.argv
[-1]
24 disassemble
= subprocess
.Popen([llvm_dis
, "-o", "-", bitcode_file
],
25 stdout
=subprocess
.PIPE
)
26 check
= subprocess
.Popen(filecheck_args
, stdin
=disassemble
.stdout
)
27 disassemble
.stdout
.close()
29 sys
.exit(check
.returncode
)