@@ -340,6 +340,17 @@ InputArgList Driver::ParseArgStrings(ArrayRef<const char *> ArgStrings,
340340                       DiagnosticsEngine::Warning;
341341      continue ;
342342    }
343+     //  Emit an unsupported and removed diagnostic for any options that were
344+     //  previously supported and subsequently removed.  This is considered a
345+     //  special case scenario that is currently being used for FPGA related
346+     //  options that did not go through the regular deprecation process.
347+     if  (A->getOption ().hasFlag (options::UnsupportedRemoved)) {
348+       Diag (diag::err_drv_unsupported_opt_removed) << A->getAsString (Args);
349+       ContainsError |= Diags.getDiagnosticLevel (
350+                            diag::err_drv_unsupported_opt_removed,
351+                            SourceLocation ()) > DiagnosticsEngine::Warning;
352+       continue ;
353+     }
343354
344355    //  Deprecated options emit a diagnostic about deprecation, but are still
345356    //  supported until removed. It's possible to have a deprecated option which
@@ -886,6 +897,10 @@ static bool isValidSYCLTriple(llvm::Triple T) {
886897      ((T.getArch () == llvm::Triple::spir && A != " spir"  ) ||
887898       (T.getArch () == llvm::Triple::spir64 && A != " spir64"  )))
888899    return  false ;
900+ 
901+   //  spir64_fpga is not supported.
902+   if  (T.isSPIR () && T.getSubArch () == llvm::Triple::SPIRSubArch_fpga)
903+     return  false ;
889904  return  true ;
890905}
891906
@@ -896,10 +911,19 @@ static const char *getDefaultSYCLArch(Compilation &C) {
896911  return  " spir64"  ;
897912}
898913
899- llvm::Triple Driver::getSYCLDeviceTriple (StringRef TargetArch) const  {
914+ llvm::Triple Driver::getSYCLDeviceTriple (StringRef TargetArch,
915+                                          const  Arg *Arg) const  {
900916  SmallVector<StringRef, 5 > SYCLAlias = {
901917      " spir"  ,       " spir64"  ,  " spir64_fpga"  , " spir64_x86_64"  ,
902918      " spir64_gen"  , " spirv32"  , " spirv64"  ,     " nvptx64"  };
919+   //  spir64_fpga is no longer supported.
920+   llvm::Triple TargetTriple (TargetArch);
921+   if  (Arg && !Arg->isClaimed () && TargetTriple.isSPIR () &&
922+       TargetTriple.getSubArch () == llvm::Triple::SPIRSubArch_fpga) {
923+     Diag (diag::err_drv_unsupported_opt_removed)
924+         << Arg->getSpelling ().str () + TargetArch.str ();
925+     Arg->claim ();
926+   }
903927  if  (llvm::is_contained (SYCLAlias, TargetArch)) {
904928    llvm::Triple TT;
905929    TT.setArchName (TargetArch);
@@ -1239,8 +1263,17 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
12391263        << ArgValue << A->getOption ().getName ();
12401264  };
12411265
1266+   //  TODO: Transition to using -fsycl-link as a flag as opposed to an option
1267+   //  that takes an argument.  The use of 'default' is a temporary solution as we
1268+   //  remove FPGA support.
12421269  Arg *SYCLLink = getArgRequiringSYCLRuntime (options::OPT_fsycl_link_EQ);
1243-   checkSingleArgValidity (SYCLLink, {" early"  , " image"  });
1270+   checkSingleArgValidity (SYCLLink, {" early"  , " image"  , " default"  });
1271+ 
1272+   //  Use of -fsycl-link=early and -fsycl-link=image are not supported.
1273+   if  (SYCLLink && (SYCLLink->getValue () == StringRef (" early"  ) ||
1274+                    SYCLLink->getValue () == StringRef (" image"  )))
1275+     Diag (diag::err_drv_unsupported_opt_removed)
1276+         << SYCLLink->getAsString (C.getInputArgs ());
12441277
12451278  Arg *DeviceCodeSplit =
12461279      C.getInputArgs ().getLastArg (options::OPT_fsycl_device_code_split_EQ);
@@ -1268,7 +1301,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
12681301      getArgRequiringSYCLRuntime (options::OPT_fsycl_force_target_EQ);
12691302  if  (SYCLForceTarget) {
12701303    StringRef Val (SYCLForceTarget->getValue ());
1271-     llvm::Triple TT (getSYCLDeviceTriple (Val));
1304+     llvm::Triple TT (getSYCLDeviceTriple (Val, SYCLForceTarget ));
12721305    if  (!isValidSYCLTriple (TT))
12731306      Diag (clang::diag::err_drv_invalid_sycl_target) << Val;
12741307  }
@@ -2730,7 +2763,6 @@ void Driver::PrintHelp(bool ShowHidden) const {
27302763                      VisibilityMask);
27312764}
27322765
2733- 
27342766//  Print the help from any of the given tools which are used for AOT
27352767//  compilation for SYCL
27362768void  Driver::PrintSYCLToolHelp (const  Compilation &C) const  {
@@ -2743,9 +2775,12 @@ void Driver::PrintSYCLToolHelp(const Compilation &C) const {
27432775    if  (AV == " gen"   || AV == " all"  )
27442776      HelpArgs.push_back (std::make_tuple (getSYCLDeviceTriple (" spir64_gen"  ),
27452777                                         " ocloc"  , " --help"  , " "  ));
2746-     if  (AV == " fpga"   || AV == " all"  )
2778+     if  (AV == " fpga"  ) {
2779+       Diag (diag::err_drv_unsupported_opt_removed)
2780+           << A->getSpelling ().str () + AV.str ();
27472781      HelpArgs.push_back (std::make_tuple (getSYCLDeviceTriple (" spir64_fpga"  ),
27482782                                         " aoc"  , " -help"  , " -sycl"  ));
2783+     }
27492784    if  (AV == " x86_64"   || AV == " all"  )
27502785      HelpArgs.push_back (std::make_tuple (getSYCLDeviceTriple (" spir64_x86_64"  ),
27512786                                         " opencl-aot"  , " --help"  , " "  ));
@@ -4003,9 +4038,9 @@ bool Driver::checkForSYCLDefaultDevice(Compilation &C,
40034038
40044039  //  Do not do the check if the default device is passed in -fsycl-targets
40054040  //  or if -fsycl-targets isn't passed (that implies default device)
4006-   if  (const  Arg *A = Args.getLastArg (options::OPT_fsycl_targets_EQ)) {
4041+   if  (const  Arg *A = Args.getLastArgNoClaim (options::OPT_fsycl_targets_EQ)) {
40074042    for  (const  char  *Val : A->getValues ()) {
4008-       llvm::Triple TT (C.getDriver ().getSYCLDeviceTriple (Val));
4043+       llvm::Triple TT (C.getDriver ().getSYCLDeviceTriple (Val, A ));
40094044      if  ((TT.isSPIROrSPIRV ()) && TT.getSubArch () == llvm::Triple::NoSubArch)
40104045        //  Default triple found
40114046        return  false ;
@@ -6652,7 +6687,8 @@ class OffloadingActionBuilder final {
66526687              continue ;
66536688            }
66546689
6655-             llvm::Triple TT (C.getDriver ().getSYCLDeviceTriple (Val));
6690+             llvm::Triple TT (
6691+                 C.getDriver ().getSYCLDeviceTriple (Val, SYCLTargetsValues));
66566692            std::string NormalizedName = TT.normalize ();
66576693
66586694            //  Make sure we don't have a duplicate triple.
0 commit comments