forked from OSchip/llvm-project
[AMDGPU] Add debugger related target options
Differential Revision: http://reviews.llvm.org/D18748 llvm-svn: 266133
This commit is contained in:
parent
d5faa267c4
commit
5124bf8edc
|
@ -95,6 +95,8 @@ def m_ppc_Features_Group : OptionGroup<"<ppc features group>">,
|
|||
Group<m_Group>;
|
||||
def m_wasm_Features_Group : OptionGroup<"<wasm features group>">,
|
||||
Group<m_Group>;
|
||||
def m_amdgpu_Features_Group : OptionGroup<"<amdgpu features group>">,
|
||||
Group<m_Group>;
|
||||
|
||||
def m_libc_Group : OptionGroup<"<m libc group>">, Group<m_Group>;
|
||||
def u_Group : OptionGroup<"<u group>">;
|
||||
|
@ -1446,6 +1448,16 @@ def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group<m_aarch64_Features_Group>,
|
|||
def msimd128 : Flag<["-"], "msimd128">, Group<m_wasm_Features_Group>;
|
||||
def mno_simd128 : Flag<["-"], "mno-simd128">, Group<m_wasm_Features_Group>;
|
||||
|
||||
def mamdgpu_debugger_abi : Joined<["-"], "mamdgpu-debugger-abi=">,
|
||||
Flags<[HelpHidden]>,
|
||||
Group<m_Group>,
|
||||
HelpText<"Generate additional code for specified <version> of debugger ABI (AMDGPU only)">,
|
||||
MetaVarName<"<version>">;
|
||||
def mamdgpu_debugger_insert_nops : Flag<["-"], "mamdgpu-debugger-insert-nops">,
|
||||
Group<m_amdgpu_Features_Group>;
|
||||
def mamdgpu_debugger_reserve_trap_regs : Flag<["-"], "mamdgpu-debugger-reserve-trap-regs">,
|
||||
Group<m_amdgpu_Features_Group>;
|
||||
|
||||
def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
|
||||
def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>;
|
||||
def mpower8_vector : Flag<["-"], "mpower8-vector">,
|
||||
|
|
|
@ -2391,6 +2391,22 @@ static void getWebAssemblyTargetFeatures(const ArgList &Args,
|
|||
handleTargetFeaturesGroup(Args, Features, options::OPT_m_wasm_Features_Group);
|
||||
}
|
||||
|
||||
static void getAMDGPUTargetFeatures(const Driver &D, const ArgList &Args,
|
||||
std::vector<const char *> &Features) {
|
||||
if (const Arg *dAbi = Args.getLastArg(options::OPT_mamdgpu_debugger_abi)) {
|
||||
StringRef value = dAbi->getValue();
|
||||
if (value == "1.0") {
|
||||
Features.push_back("+amdgpu-debugger-insert-nops");
|
||||
Features.push_back("+amdgpu-debugger-reserve-trap-regs");
|
||||
} else {
|
||||
D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args);
|
||||
}
|
||||
}
|
||||
|
||||
handleTargetFeaturesGroup(
|
||||
Args, Features, options::OPT_m_amdgpu_Features_Group);
|
||||
}
|
||||
|
||||
static void getTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple,
|
||||
const ArgList &Args, ArgStringList &CmdArgs,
|
||||
bool ForAS) {
|
||||
|
@ -2436,6 +2452,10 @@ static void getTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple,
|
|||
case llvm::Triple::wasm64:
|
||||
getWebAssemblyTargetFeatures(Args, Features);
|
||||
break;
|
||||
case llvm::Triple::r600:
|
||||
case llvm::Triple::amdgcn:
|
||||
getAMDGPUTargetFeatures(D, Args, Features);
|
||||
break;
|
||||
}
|
||||
|
||||
// Find the last of each feature.
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// Check handling of AMDGPU target features.
|
||||
//
|
||||
// -mamdgpu-debugger-abi=0.0
|
||||
// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=0.0 %s -o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-0-0 %s
|
||||
// CHECK-MAMDGPU-DEBUGGER-ABI-0-0: the clang compiler does not support '-mamdgpu-debugger-abi=0.0'
|
||||
//
|
||||
// -mamdgpu-debugger-abi=1.0
|
||||
// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=1.0 %s -o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s
|
||||
// CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops" "-target-feature" "+amdgpu-debugger-reserve-trap-regs"
|
||||
//
|
||||
// -mamdgpu-debugger-insert-nops
|
||||
// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-insert-nops %s -o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-INSERT-NOPS %s
|
||||
// CHECK-MAMDGPU-DEBUGGER-INSERT-NOPS: "-target-feature" "+amdgpu-debugger-insert-nops"
|
||||
//
|
||||
// -mamdgpu-debugger-reserve-trap-regs
|
||||
// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-reserve-trap-regs %s -o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-RESERVE-TRAP-REGS %s
|
||||
// CHECK-MAMDGPU-DEBUGGER-RESERVE-TRAP-REGS: "-target-feature" "+amdgpu-debugger-reserve-trap-regs"
|
Loading…
Reference in New Issue