handleArguments(C, Args, Inputs, Actions);
- // Builder to be used to build offloading actions.
- OffloadingActionBuilder OffloadBuilder(C, Args, Inputs);
-
bool UseNewOffloadingDriver =
C.isOffloadingHostKind(Action::OFK_OpenMP) ||
Args.hasFlag(options::OPT_offload_new_driver,
options::OPT_no_offload_new_driver, false);
+ // Builder to be used to build offloading actions.
+ std::unique_ptr<OffloadingActionBuilder> OffloadBuilder =
+ !UseNewOffloadingDriver
+ ? std::make_unique<OffloadingActionBuilder>(C, Args, Inputs)
+ : nullptr;
+
// Construct the actions to perform.
HeaderModulePrecompileJobAction *HeaderModuleAction = nullptr;
ExtractAPIJobAction *ExtractAPIAction = nullptr;
// Use the current host action in any of the offloading actions, if
// required.
if (!UseNewOffloadingDriver)
- if (OffloadBuilder.addHostDependenceToDeviceActions(Current, InputArg))
+ if (OffloadBuilder->addHostDependenceToDeviceActions(Current, InputArg))
break;
for (phases::ID Phase : PL) {
// Add any offload action the host action depends on.
if (!UseNewOffloadingDriver)
- Current = OffloadBuilder.addDeviceDependencesToHostAction(
+ Current = OffloadBuilder->addDeviceDependencesToHostAction(
Current, InputArg, Phase, PL.back(), FullPL);
if (!Current)
break;
// Use the current host action in any of the offloading actions, if
// required.
if (!UseNewOffloadingDriver)
- if (OffloadBuilder.addHostDependenceToDeviceActions(Current, InputArg))
+ if (OffloadBuilder->addHostDependenceToDeviceActions(Current, InputArg))
break;
// Try to build the offloading actions and add the result as a dependency
// Add any top level actions generated for offloading.
if (!UseNewOffloadingDriver)
- OffloadBuilder.appendTopLevelActions(Actions, Current, InputArg);
+ OffloadBuilder->appendTopLevelActions(Actions, Current, InputArg);
else if (Current)
Current->propagateHostOffloadInfo(C.getActiveOffloadKinds(),
/*BoundArch=*/nullptr);
Arg *FinalPhaseArg;
if (getFinalPhase(Args, &FinalPhaseArg) == phases::Link)
if (!UseNewOffloadingDriver)
- OffloadBuilder.appendDeviceLinkActions(Actions);
+ OffloadBuilder->appendDeviceLinkActions(Actions);
}
if (!LinkerInputs.empty()) {
if (!UseNewOffloadingDriver)
- if (Action *Wrapper = OffloadBuilder.makeHostLinkAction())
+ if (Action *Wrapper = OffloadBuilder->makeHostLinkAction())
LinkerInputs.push_back(Wrapper);
Action *LA;
// Check if this Linker Job should emit a static library.
LA = C.MakeAction<LinkJobAction>(LinkerInputs, types::TY_Image);
}
if (!UseNewOffloadingDriver)
- LA = OffloadBuilder.processHostLinkAction(LA);
+ LA = OffloadBuilder->processHostLinkAction(LA);
Actions.push_back(LA);
}