Skip to content

Commit 6b9fb17

Browse files
committed
Address rewview feedback
- Renames ExperimentalPlatformCCallingConvention to PlatformCCallingConvention. - Removes non-arm calling convention support as this feature is working around a clang bug for some arm triples which we hope to see resolved. - Removes misleading MetaVarName from platform-c-calling-convention argument. - Replaces other uses of LLVM::CallingConv::C with IGM.getOptions().PlatformCCallingConvention().
1 parent 19f74e2 commit 6b9fb17

File tree

7 files changed

+12
-62
lines changed

7 files changed

+12
-62
lines changed

include/swift/AST/IRGenOptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ class IRGenOptions {
479479
std::string TrapFuncName = "";
480480

481481
/// The calling convention used to perform non-swift calls.
482-
llvm::CallingConv::ID ExperimentalPlatformCCallingConvention;
482+
llvm::CallingConv::ID PlatformCCallingConvention;
483483

484484
IRGenOptions()
485485
: DWARFVersion(2),
@@ -522,7 +522,7 @@ class IRGenOptions {
522522
UseRelativeProtocolWitnessTables(false), CmdArgs(),
523523
SanitizeCoverage(llvm::SanitizerCoverageOptions()),
524524
TypeInfoFilter(TypeInfoDumpFilter::All),
525-
ExperimentalPlatformCCallingConvention(llvm::CallingConv::C) {
525+
PlatformCCallingConvention(llvm::CallingConv::C) {
526526
#ifndef NDEBUG
527527
DisableRoundTripDebugTypes = false;
528528
#else

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,12 +1225,11 @@ def enable_ossa_complete_lifetimes :
12251225
Flag<["-"], "enable-ossa-complete-lifetimes">,
12261226
HelpText<"Require linear OSSA lifetimes after SILGen">;
12271227

1228-
def experimental_platform_c_calling_convention :
1228+
def platform_c_calling_convention :
12291229
Separate<["-"], "experimental-platform-c-calling-convention">,
12301230
HelpText<"Which calling convention is used to perform non-swift calls. "
1231-
"Defaults to llvm's standard C calling convention.">,
1232-
MetaVarName<"standard|task-to-thread">;
1233-
def experimental_platform_c_calling_convention_EQ :
1231+
"Defaults to llvm's standard C calling convention.">;
1232+
def platform_c_calling_convention_EQ :
12341233
Joined<["-"], "experimental-platform-c-calling-convention=">,
1235-
Alias<experimental_platform_c_calling_convention>;
1234+
Alias<platform_c_calling_convention>;
12361235
} // end let Flags = [FrontendOption, NoDriverOption, HelpHidden]

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,62 +2807,13 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
28072807
return true;
28082808
}
28092809

2810-
if (const Arg *A = Args.getLastArg(options::OPT_experimental_platform_c_calling_convention)) {
2811-
Opts.ExperimentalPlatformCCallingConvention =
2810+
if (const Arg *A = Args.getLastArg(options::OPT_platform_c_calling_convention)) {
2811+
Opts.PlatformCCallingConvention =
28122812
llvm::StringSwitch<llvm::CallingConv::ID>(A->getValue())
28132813
.Case("c", llvm::CallingConv::C)
2814-
.Case("fast", llvm::CallingConv::Fast)
2815-
.Case("cold", llvm::CallingConv::Cold)
2816-
.Case("ghc", llvm::CallingConv::GHC)
2817-
.Case("hipe", llvm::CallingConv::HiPE)
2818-
.Case("webkit_js", llvm::CallingConv::WebKit_JS)
2819-
.Case("anyreg", llvm::CallingConv::AnyReg)
2820-
.Case("preservemost", llvm::CallingConv::PreserveMost)
2821-
.Case("preserveall", llvm::CallingConv::PreserveAll)
2822-
.Case("swift", llvm::CallingConv::Swift)
2823-
.Case("cxx_fast_tls", llvm::CallingConv::CXX_FAST_TLS)
2824-
.Case("tail", llvm::CallingConv::Tail)
2825-
.Case("cfguard_check", llvm::CallingConv::CFGuard_Check)
2826-
.Case("swifttail", llvm::CallingConv::SwiftTail)
2827-
.Case("firsttargetcc", llvm::CallingConv::FirstTargetCC)
2828-
.Case("x86_stdcall", llvm::CallingConv::X86_StdCall)
2829-
.Case("x86_fastcall", llvm::CallingConv::X86_FastCall)
28302814
.Case("arm_apcs", llvm::CallingConv::ARM_APCS)
28312815
.Case("arm_aapcs", llvm::CallingConv::ARM_AAPCS)
28322816
.Case("arm_aapcs_vfp", llvm::CallingConv::ARM_AAPCS_VFP)
2833-
.Case("msp430_intr", llvm::CallingConv::MSP430_INTR)
2834-
.Case("x86_thiscall", llvm::CallingConv::X86_ThisCall)
2835-
.Case("ptx_kernel", llvm::CallingConv::PTX_Kernel)
2836-
.Case("ptx_device", llvm::CallingConv::PTX_Device)
2837-
.Case("spir_func", llvm::CallingConv::SPIR_FUNC)
2838-
.Case("spir_kernel", llvm::CallingConv::SPIR_KERNEL)
2839-
.Case("intel_ocl_bi", llvm::CallingConv::Intel_OCL_BI)
2840-
.Case("x86_64_sysv", llvm::CallingConv::X86_64_SysV)
2841-
.Case("win64", llvm::CallingConv::Win64)
2842-
.Case("x86_vectorcall", llvm::CallingConv::X86_VectorCall)
2843-
.Case("x86_intr", llvm::CallingConv::X86_INTR)
2844-
.Case("avr_intr", llvm::CallingConv::AVR_INTR)
2845-
.Case("avr_signal", llvm::CallingConv::AVR_SIGNAL)
2846-
.Case("avr_builtin", llvm::CallingConv::AVR_BUILTIN)
2847-
.Case("amdgpu_vs", llvm::CallingConv::AMDGPU_VS)
2848-
.Case("amdgpu_gs", llvm::CallingConv::AMDGPU_GS)
2849-
.Case("amdgpu_ps", llvm::CallingConv::AMDGPU_PS)
2850-
.Case("amdgpu_cs", llvm::CallingConv::AMDGPU_CS)
2851-
.Case("amdgpu_kernel", llvm::CallingConv::AMDGPU_KERNEL)
2852-
.Case("x86_regcall", llvm::CallingConv::X86_RegCall)
2853-
.Case("amdgpu_hs", llvm::CallingConv::AMDGPU_HS)
2854-
.Case("msp430_builtin", llvm::CallingConv::MSP430_BUILTIN)
2855-
.Case("amdgpu_ls", llvm::CallingConv::AMDGPU_LS)
2856-
.Case("amdgpu_es", llvm::CallingConv::AMDGPU_ES)
2857-
.Case("aarch64_vectorcall", llvm::CallingConv::AArch64_VectorCall)
2858-
.Case("aarch64_sve_vectorcall", llvm::CallingConv::AArch64_SVE_VectorCall)
2859-
.Case("wasm_emscripteninvoke", llvm::CallingConv::WASM_EmscriptenInvoke)
2860-
.Case("amdgpu_gfx", llvm::CallingConv::AMDGPU_Gfx)
2861-
.Case("m68k_intr", llvm::CallingConv::M68k_INTR)
2862-
.Case("aarch64_sme_abi_support_routines_preservemost_from_x0",
2863-
llvm::CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X0)
2864-
.Case("aarch64_sme_abi_support_routines_preservemost_from_x2",
2865-
llvm::CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X2)
28662817
.Default(llvm::CallingConv::C);
28672818
}
28682819

lib/IRGen/GenCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ llvm::CallingConv::ID irgen::expandCallingConv(IRGenModule &IGM,
322322
case SILFunctionTypeRepresentation::ObjCMethod:
323323
case SILFunctionTypeRepresentation::CXXMethod:
324324
case SILFunctionTypeRepresentation::Block:
325-
return IGM.getOptions().ExperimentalPlatformCCallingConvention;
325+
return IGM.getOptions().PlatformCCallingConvention;
326326

327327
case SILFunctionTypeRepresentation::Method:
328328
case SILFunctionTypeRepresentation::WitnessMethod:

lib/IRGen/GenDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3297,7 +3297,7 @@ llvm::Constant *swift::irgen::emitCXXConstructorThunkIfNeeded(
32973297
llvm::Function *thunk = llvm::Function::Create(
32983298
assumedFnType, llvm::Function::PrivateLinkage, name, &IGM.Module);
32993299

3300-
thunk->setCallingConv(llvm::CallingConv::C);
3300+
thunk->setCallingConv(IGM.getOptions().PlatformCCallingConvention());
33013301

33023302
llvm::AttrBuilder attrBuilder(IGM.getLLVMContext());
33033303
IGM.constructInitialFnAttributes(attrBuilder);

lib/IRGen/GenHeap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,7 @@ emitHeapMetadataRefForUnknownHeapObject(IRGenFunction &IGF,
19781978
auto metadata = IGF.Builder.CreateCall(
19791979
IGF.IGM.getGetObjectClassFunctionPointer(), object);
19801980
metadata->setName(object->getName() + ".Type");
1981-
metadata->setCallingConv(llvm::CallingConv::C);
1981+
metadata->setCallingConv(IGM.getOptions().PlatformCCallingConvention());
19821982
metadata->setDoesNotThrow();
19831983
metadata->addFnAttr(llvm::Attribute::ReadOnly);
19841984
return metadata;

lib/IRGen/IRGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
570570
InvariantNode = llvm::MDNode::get(getLLVMContext(), {});
571571
DereferenceableID = getLLVMContext().getMDKindID("dereferenceable");
572572

573-
C_CC = llvm::CallingConv::C;
573+
C_CC = IGM.getOptions().PlatformCCallingConvention();
574574
// TODO: use "tinycc" on platforms that support it
575575
DefaultCC = SWIFT_DEFAULT_LLVM_CC;
576576
SwiftCC = llvm::CallingConv::Swift;

0 commit comments

Comments
 (0)