mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-16 14:26:17 +00:00
[opt][PassInfo] Allow opt to run passes that need target machine.
When registering a pass, a pass can now specify a second construct that takes as argument a pointer to TargetMachine. The PassInfo class has been updated to reflect that possibility. If such a constructor exists opt will use it instead of the default constructor when instantiating the pass. Since such IR passes are supposed to be rare, no specific support has been added to this commit to allow an easy registration of such a pass. In other words, for such pass, the initialization function has to be hand-written (see CodeGenPrepare for instance). Now, codegenprepare can be tested using opt: opt -codegenprepare -mtriple=mytriple input.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199430 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -795,7 +795,9 @@ int main(int argc, char **argv) {
|
||||
|
||||
const PassInfo *PassInf = PassList[i];
|
||||
Pass *P = 0;
|
||||
if (PassInf->getNormalCtor())
|
||||
if (PassInf->getTargetMachineCtor())
|
||||
P = PassInf->getTargetMachineCtor()(TM.get());
|
||||
else if (PassInf->getNormalCtor())
|
||||
P = PassInf->getNormalCtor()();
|
||||
else
|
||||
errs() << argv[0] << ": cannot create pass: "
|
||||
|
Reference in New Issue
Block a user