[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-dev
Subject: [LLVMdev] MAJOR API CHANGE: Pass initialization without static
From: Owen Anderson <resistor () mac ! com>
Date: 2010-10-08 18:29:39
Message-ID: F699835F-6377-4E1E-80F4-C3C7832EA8D2 () mac ! com
[Download RAW message or body]
Hello fellow LLVM-ers,
As those of you who follow llvm-commits have probably noticed, I've been hard at work \
reworking our pass infrastructure to perform pass initialization/registration without \
static constructors. This is a boon for clients of the LLVM libraries, as they can \
now control when and if initialization occurs, as opposed to being forced to incur \
the initialization cost at startup, negatively impacting their startup times.
The new-style solution consists of an llvm::initializeMyPass method for every pass. \
These initialization routines must be invoked before the PassManager will be able to \
resolve pipelines involving your pass. For convenience, LLVM now exposes per-library \
batch initialization routines, i.e. initializeScalarOpts(), which initialize all the \
passes within a given library in a single go.
* WHAT THIS MEANS FOR LLVM USERS
Users of LLVM will need to add explicit calls to the initialization routines to their \
programs. The trivial solution is to perform initialization at the beginning of \
main(), and to call the batch initialization routines for every LLVM library you link \
against. Clients interested in improving launch time and/or minimizing unnecessary \
linkage can defer initialization until it is needs, and/or only call the \
initialization routines for the individual passes that they depend on.
Dynamically loaded plugins containing passes will continue to use the old-style style \
initialization scheme, and thus will continue to incur the cost of static \
constructors. Don't use them if you don't want static constructors.
* WHAT THIS MEANS FOR LLVM DEVELOPERS
I have already done this work for all passes already in the LLVM tree, but developers \
need to be aware for future work:
You MUST use the new-style INITIALIZE_PASS, INITIALIZE_AG_PASS, and \
INITIALIZE_ANALYSIS_GROUP macros in place of the old-style RegisterPass<> templates. \
These macros will create an initializeMyPass() method, which you *MUST* declare in \
InitializePasses.h, and which you must add to your library's batch initialization \
method.
--Owen Anderson
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic