2 Script to assemble a text IR file and run FileCheck on the output with the
3 provided arguments. The first 2 arguments are the paths to the llvm-as and
4 FileCheck binaries, followed by arguments to be passed to FileCheck. The last
5 argument is the text IR file to disassemble.
8 python llvm-as-and-filecheck.py
9 <path to llvm-as> <path to FileCheck>
10 [arguments passed to FileCheck] <path to text IR file>
18 filecheck
= sys
.argv
[2]
23 filecheck_args
.extend(sys
.argv
[3:-1])
24 ir_file
= sys
.argv
[-1]
25 bitcode_file
= ir_file
+ ".bc"
27 # Verify the IR actually parses since FileCheck is too dumb to know.
28 assemble
= subprocess
.Popen([llvm_as
, "-o", bitcode_file
, ir_file
])
29 assemble
.communicate()
31 if assemble
.returncode
!= 0:
33 print(assemble
.stderr
)
35 print(assemble
.stdout
)
38 filecheck_args
.append("--input-file")
39 filecheck_args
.append(ir_file
)
41 check
= subprocess
.Popen(filecheck_args
)
43 sys
.exit(check
.returncode
)