diff options
author | Min-Yih Hsu <minyihh@uci.edu> | 2023-08-22 23:13:54 -0700 |
---|---|---|
committer | Min-Yih Hsu <minyihh@uci.edu> | 2023-10-15 16:13:43 -0700 |
commit | fd4f96290ac99bf8b9284d3b32743cac0bb135ea (patch) | |
tree | 2a4eef1f0d642bb96cc9bd96c8f294d2b5d39da2 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 42b707e5b438be538e3560429d0b4afcd7ca05be (diff) | |
download | llvm-fd4f96290ac99bf8b9284d3b32743cac0bb135ea.zip llvm-fd4f96290ac99bf8b9284d3b32743cac0bb135ea.tar.gz llvm-fd4f96290ac99bf8b9284d3b32743cac0bb135ea.tar.bz2 |
[Clang][M68k] Add Clang support for the new M68k_RTD CC
This patch adds `CC_M68kRTD`, which will be used on function if either
`__attribute__((m68k_rtd))` is presented or `-mrtd` flag is given.
Differential Revision: https://reviews.llvm.org/D149867
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index bb44249..4e6d7bb 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -648,6 +648,7 @@ static bool FixupInvocation(CompilerInvocation &Invocation, emitError |= (DefaultCC == LangOptions::DCC_VectorCall || DefaultCC == LangOptions::DCC_RegCall) && !T.isX86(); + emitError |= DefaultCC == LangOptions::DCC_RtdCall && Arch != llvm::Triple::m68k; if (emitError) Diags.Report(diag::err_drv_argument_not_allowed_with) << A->getSpelling() << T.getTriple(); @@ -3865,11 +3866,17 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, Diags.Report(diag::err_drv_argument_not_allowed_with) << A->getSpelling() << "-fdefault-calling-conv"; else { - if (T.getArch() != llvm::Triple::x86) + switch (T.getArch()) { + case llvm::Triple::x86: + Opts.setDefaultCallingConv(LangOptions::DCC_StdCall); + break; + case llvm::Triple::m68k: + Opts.setDefaultCallingConv(LangOptions::DCC_RtdCall); + break; + default: Diags.Report(diag::err_drv_argument_not_allowed_with) << A->getSpelling() << T.getTriple(); - else - Opts.setDefaultCallingConv(LangOptions::DCC_StdCall); + } } } |