Skip to content

Fixing up IRGenModule to handle changes in CodeGenOptions. #26263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions lib/IRGen/IRGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ static clang::CodeGenerator *createClangCodeGenerator(ASTContext &Context,

auto &CGO = Importer->getClangCodeGenOpts();
CGO.OptimizationLevel = Opts.shouldOptimize() ? 3 : 0;
CGO.DisableFPElim = Opts.DisableFPElim;
CGO.setFramePointer(Opts.DisableFPElim
? clang::CodeGenOptions::FramePointerKind::All
: clang::CodeGenOptions::FramePointerKind::None);
CGO.DiscardValueNames = !Opts.shouldProvideValueNames();
switch (Opts.DebugInfoLevel) {
case IRGenDebugInfoLevel::None:
Expand Down Expand Up @@ -895,12 +897,8 @@ bool swift::irgen::shouldRemoveTargetFeature(StringRef feature) {
void IRGenModule::constructInitialFnAttributes(llvm::AttrBuilder &Attrs,
OptimizationMode FuncOptMode) {
// Add DisableFPElim.
if (!IRGen.Opts.DisableFPElim) {
Attrs.addAttribute("no-frame-pointer-elim", "false");
} else {
Attrs.addAttribute("no-frame-pointer-elim", "true");
Attrs.addAttribute("no-frame-pointer-elim-non-leaf");
}
Attrs.addAttribute("frame-pointer",
IRGen.Opts.DisableFPElim ? "all" : "none");

// Add target-cpu and target-features if they are non-null.
auto *Clang = static_cast<ClangImporter *>(Context.getClangModuleLoader());
Expand Down