functions.cpp (ldc-1.32.1) | : | functions.cpp (ldc-1.32.2) | ||
---|---|---|---|---|
skipping to change at line 51 | skipping to change at line 51 | |||
#include "gen/llvmhelpers.h" | #include "gen/llvmhelpers.h" | |||
#include "gen/logger.h" | #include "gen/logger.h" | |||
#include "gen/mangling.h" | #include "gen/mangling.h" | |||
#include "gen/nested.h" | #include "gen/nested.h" | |||
#include "gen/optimizer.h" | #include "gen/optimizer.h" | |||
#include "gen/pgo_ASTbased.h" | #include "gen/pgo_ASTbased.h" | |||
#include "gen/pragma.h" | #include "gen/pragma.h" | |||
#include "gen/runtime.h" | #include "gen/runtime.h" | |||
#include "gen/scope_exit.h" | #include "gen/scope_exit.h" | |||
#include "gen/tollvm.h" | #include "gen/tollvm.h" | |||
#include "gen/to_string.h" | ||||
#include "gen/uda.h" | #include "gen/uda.h" | |||
#include "ir/irdsymbol.h" | #include "ir/irdsymbol.h" | |||
#include "ir/irfunction.h" | #include "ir/irfunction.h" | |||
#include "ir/irmodule.h" | #include "ir/irmodule.h" | |||
#include "llvm/IR/Intrinsics.h" | #include "llvm/IR/Intrinsics.h" | |||
#include "llvm/IR/CFG.h" | #include "llvm/IR/CFG.h" | |||
#include "llvm/Target/TargetMachine.h" | #include "llvm/Target/TargetMachine.h" | |||
#include "llvm/Target/TargetOptions.h" | #include "llvm/Target/TargetOptions.h" | |||
#include "llvm/Transforms/Utils/Cloning.h" | #include "llvm/Transforms/Utils/Cloning.h" | |||
#include <iostream> | #include <iostream> | |||
skipping to change at line 705 | skipping to change at line 706 | |||
// such that they can be overridden by UDAs. | // such that they can be overridden by UDAs. | |||
applyTargetMachineAttributes(*func, *gTargetMachine); | applyTargetMachineAttributes(*func, *gTargetMachine); | |||
if (!fdecl->fbody && opts::noPLT) { | if (!fdecl->fbody && opts::noPLT) { | |||
// Add `NonLazyBind` attribute to function declarations, | // Add `NonLazyBind` attribute to function declarations, | |||
// the codegen options allow skipping PLT. | // the codegen options allow skipping PLT. | |||
func->addFnAttr(LLAttribute::NonLazyBind); | func->addFnAttr(LLAttribute::NonLazyBind); | |||
} | } | |||
if (f->next->toBasetype()->ty == TY::Tnoreturn) { | if (f->next->toBasetype()->ty == TY::Tnoreturn) { | |||
func->addFnAttr(LLAttribute::NoReturn); | func->addFnAttr(LLAttribute::NoReturn); | |||
} | } | |||
#if LDC_LLVM_VER >= 1300 | ||||
if (opts::fWarnStackSize.getNumOccurrences() > 0 && | ||||
opts::fWarnStackSize < UINT_MAX) { | ||||
// Cache the int->string conversion result. | ||||
static std::string thresholdString = ldc::to_string(opts::fWarnStackSize); | ||||
func->addFnAttr("warn-stack-size", thresholdString); | ||||
} | ||||
#endif | ||||
applyFuncDeclUDAs(fdecl, irFunc); | applyFuncDeclUDAs(fdecl, irFunc); | |||
// parameter attributes | // parameter attributes | |||
if (!DtoIsIntrinsic(fdecl)) { | if (!DtoIsIntrinsic(fdecl)) { | |||
applyParamAttrsToLLFunc(f, getIrFunc(fdecl)->irFty, func); | applyParamAttrsToLLFunc(f, getIrFunc(fdecl)->irFty, func); | |||
if (global.params.disableRedZone) { | if (global.params.disableRedZone) { | |||
func->addFnAttr(LLAttribute::NoRedZone); | func->addFnAttr(LLAttribute::NoRedZone); | |||
} | } | |||
} | } | |||
skipping to change at line 1253 | skipping to change at line 1263 | |||
} | } | |||
} | } | |||
applyXRayAttributes(*fd, *func); | applyXRayAttributes(*fd, *func); | |||
if (opts::fNullPointerIsValid) { | if (opts::fNullPointerIsValid) { | |||
#if LDC_LLVM_VER >= 1100 | #if LDC_LLVM_VER >= 1100 | |||
func->addFnAttr(LLAttribute::NullPointerIsValid); | func->addFnAttr(LLAttribute::NullPointerIsValid); | |||
#else | #else | |||
func->addFnAttr("null-pointer-is-valid", "true"); | func->addFnAttr("null-pointer-is-valid", "true"); | |||
#endif | #endif | |||
} | } | |||
if (opts::fSplitStack && !hasNoSplitStackUDA(fd)) { | ||||
func->addFnAttr("split-stack"); | ||||
} | ||||
llvm::BasicBlock *beginbb = | llvm::BasicBlock *beginbb = | |||
llvm::BasicBlock::Create(gIR->context(), "", func); | llvm::BasicBlock::Create(gIR->context(), "", func); | |||
// set up the IRBuilder scope for the function | // set up the IRBuilder scope for the function | |||
const auto savedIRBuilderScope = gIR->setInsertPoint(beginbb); | const auto savedIRBuilderScope = gIR->setInsertPoint(beginbb); | |||
gIR->ir->setFastMathFlags(irFunc->FMF); | gIR->ir->setFastMathFlags(irFunc->FMF); | |||
gIR->DBuilder.EmitFuncStart(fd); | gIR->DBuilder.EmitFuncStart(fd); | |||
// @naked: emit body and return, no prologue/epilogue | // @naked: emit body and return, no prologue/epilogue | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 13 lines changed or added |