[clang] [llvm] [HIP] add --offload-compression-level= option (PR #83605)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 10:22:45 PST 2024


================
@@ -2863,3 +2863,18 @@ void tools::addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC,
     CmdArgs.push_back("+outline-atomics");
   }
 }
+
+void tools::addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs,
+                                   llvm::opt::ArgStringList &CmdArgs) {
+  if (TCArgs.hasFlag(options::OPT_offload_compress,
+                     options::OPT_no_offload_compress, false))
+    CmdArgs.push_back("-compress");
+  if (TCArgs.hasArg(options::OPT_v))
+    CmdArgs.push_back("-verbose");
+  if (auto *Arg =
+          TCArgs.getLastArg(options::OPT_offload_compression_level_EQ)) {
+    std::string CompressionLevelArg =
+        std::string("-compression-level=") + Arg->getValue();
+    CmdArgs.push_back(TCArgs.MakeArgString(CompressionLevelArg));
----------------
Artem-B wrote:

This may be collapsed to just 
```
CmdArgs.push_back(TCArgs.MakeArgString("-compression-level=" + Arg->getValue()))`. 
```
Maybe with a `Twine` or `StringRef` wrapping the string literal.

https://github.com/llvm/llvm-project/pull/83605


More information about the cfe-commits mailing list