[LLVMdev] Passing command line arguments to optimization passes

Arnaud Allard de Grandmaison Arnaud.AllardDeGrandMaison at dibcom.com
Thu Jan 27 01:32:28 PST 2011


Hi Harel,

Several existing passes can take command line arguments. Have a look at lib/Transforms/Scalar/LoopUnrollPass.cpp for example. Its command line arguments are defined using the cl::opt objects.

Best regards,
--
Arnaud de Grandmaison
________________________________
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Harel Cain
Sent: Thursday, January 27, 2011 10:05 AM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Passing command line arguments to optimization passes

Hi all,

I was wondering if there's any way to pass command line arguments to LLVM optimization passes when run through the opt tool.

For example, suppose I register called MyPass, then I want to run

opt -load libMyPass.so -MyPass 3 < input.bc

and have "3" be available to MyPass as a kind of argv argumnet through some method.


Or does it take a major rewrite of the opt tool command line parsing?


Thanks!

Harel Cain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110127/212543a5/attachment.html>


More information about the llvm-dev mailing list