Skip to content

Commit 0793258

Browse files
committed
Add a frontend option to enable use of the swiftcall convention.
1 parent af0c7bd commit 0793258

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

include/swift/AST/IRGenOptions.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,19 @@ class IRGenOptions {
150150
/// standard library.
151151
unsigned EnableReflectionBuiltins : 1;
152152

153-
/// List of backend command-line options for -embed-bitcode.
154-
std::vector<uint8_t> CmdArgs;
155-
156153
/// Should we try to build incrementally by not emitting an object file if it
157154
/// has the same IR hash as the module that we are preparing to emit?
158155
///
159156
/// This is a debugging option meant to make it easier to perform compile time
160157
/// measurements on a non-clean build directory.
161158
unsigned UseIncrementalLLVMCodeGen : 1;
162159

160+
/// Enable use of the swiftcall calling convention.
161+
unsigned UseSwiftCall : 1;
162+
163+
/// List of backend command-line options for -embed-bitcode.
164+
std::vector<uint8_t> CmdArgs;
165+
163166
IRGenOptions() : OutputKind(IRGenOutputKind::LLVMAssembly), Verify(true),
164167
Optimize(false), Sanitize(SanitizerKind::None),
165168
DebugInfoKind(IRGenDebugInfoKind::None),
@@ -170,8 +173,9 @@ class IRGenOptions {
170173
PrintInlineTree(false), EmbedMode(IRGenEmbedMode::None),
171174
HasValueNamesSetting(false), ValueNames(false),
172175
EnableReflectionMetadata(false), EnableReflectionNames(false),
173-
EnableReflectionBuiltins(false), CmdArgs(),
174-
UseIncrementalLLVMCodeGen(true)
176+
EnableReflectionBuiltins(false),
177+
UseIncrementalLLVMCodeGen(true), UseSwiftCall(false),
178+
CmdArgs()
175179
{}
176180

177181
/// Gets the name of the specified output filename.

include/swift/Option/FrontendOptions.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def disable_objc_interop :
7373
Flag<["-"], "disable-objc-interop">,
7474
HelpText<"Disable Objective-C interop code generation and config directives">;
7575

76+
def enable_swiftcall : Flag<["-"], "enable-swiftcall">,
77+
HelpText<"Enable the use of LLVM swiftcall support">;
78+
7679
def enable_objc_attr_requires_foundation_module :
7780
Flag<["-"], "enable-objc-attr-requires-foundation-module">,
7881
HelpText<"Enable requiring uses of @objc to require importing the "

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,8 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
12171217
Opts.GenerateProfile |= Args.hasArg(OPT_profile_generate);
12181218
Opts.PrintInlineTree |= Args.hasArg(OPT_print_llvm_inline_tree);
12191219

1220+
Opts.UseSwiftCall = Args.hasArg(OPT_enable_swiftcall);
1221+
12201222
// This is set to true by default.
12211223
Opts.UseIncrementalLLVMCodeGen &=
12221224
!Args.hasArg(OPT_disable_incremental_llvm_codegeneration);

0 commit comments

Comments
 (0)