================
@@ -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())) +
+ ":" + Job.getCreator().getToolChain().getTripleString() + ":" +
+ Source.getClassName() + ":" + types::getTypeName(Source.getType()))
+ .str();
+}
+
+static void claimAndDiagnoseOffloadJobs(const Driver &D, const ArgList &Args) {
+ Arg *A = Args.getLastArg(options::OPT_offload_jobs_EQ);
+ if (!A)
+ return;
+
+ StringRef Val = A->getValue();
+ if (Val.equals_insensitive("jobserver")) {
----------------
yxsamliu wrote:
Done. I moved `--offload-jobs` parsing into one common helper and reused it in
all three places.
https://github.com/llvm/llvm-project/pull/208254
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits