[PATCH] D33222: [LegacyPassManager] Remove TargetMachine constructors
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 16 09:06:29 PDT 2017
chandlerc added a comment.
Cool! This seems to me like a really nice simplification given the fact that the LPM has significant constraints on how you construct passes.
================
Comment at: lib/CodeGen/StackProtector.cpp:101-104
+ if (!TM) {
+ TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
+ Trip = TM->getTargetTriple();
+ }
----------------
I would simple unconditionally assign here like we do with other things.
================
Comment at: lib/Target/Mips/MipsModuleISelDAGToDAG.cpp:40-41
DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n");
+ auto &TM = const_cast<MipsTargetMachine &>(
+ static_cast<const MipsTargetMachine &>(MF.getTarget()));
TM.resetSubtarget(&MF);
----------------
This is horrible. =/
I think the `MipsTargetMachine` should directly expose a const-qualified `resetSubtarget` method, as it is already doing crazy const-casting... Or it should have some other way of doing this.
I might just leave the original code for this part of the Mips backend rather than trying to make it clean in the same way.
https://reviews.llvm.org/D33222
More information about the llvm-commits
mailing list