================
@@ -5404,23 +5401,76 @@ Action *Driver::ConstructPhaseAction(
return C.MakeAction<BackendJobAction>(Input, types::TY_PP_Asm);
}
case phases::Assemble:
- // When -marm64x is used, construct jobs for the EC and native targets and
- // merge them into an archive with llvm-objcopy.
- const llvm::Triple Target(llvm::Triple::normalize(TargetTriple));
- if (Target.isOSWindows() && Args.hasArg(options::OPT_marm64x)) {
- Action *Act =
- C.MakeAction<AssembleJobAction>(std::move(Input), types::TY_Object);
- ActionList Inputs;
- Inputs.push_back(C.MakeAction<BindArchAction>(Act,
BoundArch("aarch64")));
- Inputs.push_back(C.MakeAction<BindArchAction>(Act,
BoundArch("arm64ec")));
- return C.MakeAction<ObjcopyJobAction>(Inputs, types::TY_Object);
- }
return C.MakeAction<AssembleJobAction>(std::move(Input), types::TY_Object);
}
llvm_unreachable("invalid phase in ConstructPhaseAction");
}
+static bool isOffloadDeviceCC1JobCandidate(Command &Job) {
+ const Action &Source = Job.getSource();
+ if (!isa<CompileJobAction>(Source) && !isa<BackendJobAction>(Source))
+ return false;
+
+ if (Job.getBoundArch().empty() && !Source.getOffloadingArch().empty())
+ Job.setBoundArch(Source.getOffloadingArch());
+
+ if (Job.getBoundArch().empty())
+ return false;
+
+ const llvm::opt::ArgStringList &Args = Job.getArguments();
+ if (Args.empty() || StringRef(Args.front()) != "-cc1")
+ return false;
+
+ Action::OffloadKind OKind = Source.getOffloadingDeviceKind();
+ if (OKind != Action::OFK_None && OKind != Action::OFK_Host)
+ return true;
+
+ const llvm::Triple &Triple = Job.getCreator().getToolChain().getTriple();
+ return Triple.isAMDGPU() || Triple.isNVPTX() || Triple.isSPIROrSPIRV();
+}
+
+static std::string getOffloadDeviceCC1ParallelJobGroup(const Command &Job) {
+ const Action &Source = Job.getSource();
+ return (Twine(Action::GetOffloadKindName(Source.getOffloadingDeviceKind())) +
----------------
yxsamliu wrote:
Done. I added a short comment explaining the group key and what fields must
match.
https://github.com/llvm/llvm-project/pull/208254
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits