mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Set clang code generation's frame pointer kind.
This commit is contained in:
@@ -90,6 +90,20 @@ static llvm::PointerType *createStructPointerType(IRGenModule &IGM,
|
||||
return createStructType(IGM, name, types)->getPointerTo(DefaultAS);
|
||||
};
|
||||
|
||||
static clang::CodeGenOptions::FramePointerKind
|
||||
shouldUseFramePointer(const IRGenOptions &Opts) {
|
||||
if (Opts.DisableFPElim) {
|
||||
// General frame pointer elimination is disabled.
|
||||
// Should we at least eliminate in leaf functions?
|
||||
return Opts.DisableFPElimLeaf
|
||||
? clang::CodeGenOptions::FramePointerKind::All
|
||||
: clang::CodeGenOptions::FramePointerKind::NonLeaf;
|
||||
}
|
||||
|
||||
return clang::CodeGenOptions::FramePointerKind::None;
|
||||
|
||||
}
|
||||
|
||||
static clang::CodeGenerator *createClangCodeGenerator(ASTContext &Context,
|
||||
llvm::LLVMContext &LLVMContext,
|
||||
const IRGenOptions &Opts,
|
||||
@@ -102,9 +116,7 @@ static clang::CodeGenerator *createClangCodeGenerator(ASTContext &Context,
|
||||
|
||||
auto &CGO = Importer->getClangCodeGenOpts();
|
||||
CGO.OptimizationLevel = Opts.shouldOptimize() ? 3 : 0;
|
||||
CGO.setFramePointer(Opts.DisableFPElim
|
||||
? clang::CodeGenOptions::FramePointerKind::All
|
||||
: clang::CodeGenOptions::FramePointerKind::None);
|
||||
CGO.setFramePointer(shouldUseFramePointer(Opts));
|
||||
CGO.DiscardValueNames = !Opts.shouldProvideValueNames();
|
||||
switch (Opts.DebugInfoLevel) {
|
||||
case IRGenDebugInfoLevel::None:
|
||||
|
||||
Reference in New Issue
Block a user