From e02959c5419ae25e1af7a249bf8c10d0d61679b7 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Tue, 9 Jun 2020 03:08:13 +0200 Subject: [PATCH] g2llvm: add -o flag to specify output path for LLVM IR file --- g2llvm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/g2llvm.py b/g2llvm.py index 0c2857e..4488fbb 100755 --- a/g2llvm.py +++ b/g2llvm.py @@ -20,6 +20,7 @@ parser.add_argument('input_file', action='store') parser.add_argument('-out', action='store_true', help='emit intermediate files', default=False, dest='out') parser.add_argument('-opt', action='store', help='select optimization level 0-3', default=None, dest='opt') +parser.add_argument('-o', action='store', help='LLVM IR output path', default=None, dest='output') parser.add_argument('-cfg', action='store_true', help='emit cfg', default=False, dest='cfg') results = parser.parse_args() @@ -50,7 +51,10 @@ # Verify module = opt_verify.verify(module) -llfile = str(filename + '.ll') +if results.output: + llfile = results.output +else: + llfile = str(filename + '.ll') f = open(llfile, 'w') f.write(str(module)) f.close()