Implement LLVM IR Virtual Function Elimination for Swift classes. (#39128)

- Virtual calls are done via a @llvm.type.checked.load instrinsic call with a type identifier
- Type identifier of a vfunc is the base method's mangling
- Type descriptors and class metadata get !type markers that list offsets and type identifiers of all vfuncs
- The -enable-llvm-vfe frontend flag enables VFE
- Two added tests verify the behavior on IR and by executing a program
This commit is contained in:
Kuba (Brecka) Mracek
2021-09-14 06:59:07 -07:00
committed by GitHub
parent 276d8c2074
commit 5412ed1936
11 changed files with 280 additions and 16 deletions

View File

@@ -1896,6 +1896,10 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
Opts.EnableGlobalISel = true;
}
if (Args.hasArg(OPT_enable_llvm_vfe)) {
Opts.VirtualFunctionElimination = true;
}
return false;
}