Yaxun (Sam) Liu 78b0f3701d [HIPSPV][1/4] Refactor HIP tool chain
This patch refactors the HIP tool chain for new HIP tool chain, HIPSPV
tool chain, which is added in the follow up patch part 2.

Rename HIPToolChain to HIPAMDToolChain and Renames HIP.* files to HIPAMD.*.
Introduce HIPUtility.* file where common HIP utilities, shared among HIP
tool chain implementations, are placed in.
Move constructHIPFatbinCommand() and
constructGenerateObjFileFromHIPFatBinary() to HIPUtility. HIPSPV tool
chain is going to use them.
Tweak bundle target ID in constructHIPFatbinCommand(): extra dashes are
dropped if the Target ID is empty and 'hip' offload kind is made default
for non-AMD targets.

Patch by: Henry Linjamäki

Reviewed by: Yaxun Liu, Artem Belevich, Eric Christopher

Differential Revision: https://reviews.llvm.org/D110549
2021-12-13 10:50:25 -05:00

36 lines
1.3 KiB
C++

//===--- HIPUtility.h - Common HIP Tool Chain Utilities ---------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPUTILITY_H
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPUTILITY_H
#include "clang/Driver/Tool.h"
namespace clang {
namespace driver {
namespace tools {
namespace HIP {
// Construct command for creating HIP fatbin.
void constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
StringRef OutputFileName,
const InputInfoList &Inputs,
const llvm::opt::ArgList &TCArgs, const Tool &T);
// Construct command for creating Object from HIP fatbin.
void constructGenerateObjFileFromHIPFatBinary(
Compilation &C, const InputInfo &Output, const InputInfoList &Inputs,
const llvm::opt::ArgList &Args, const JobAction &JA, const Tool &T);
} // namespace HIP
} // namespace tools
} // namespace driver
} // namespace clang
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPUTILITY_H