Skip to content
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

Add support for LLVM 12 #3663

Merged
merged 2 commits into from
Feb 13, 2021
Merged
Show file tree
Hide file tree
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
30 changes: 14 additions & 16 deletions .azure-pipelines/android-llvm-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,24 @@ components="aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassemb
aggressiveinstcombine all all-targets analysis arm armasmparser armcodegen armdesc armdisassembler arminfo \
armutils asmparser asmprinter binaryformat bitreader bitstreamreader bitwriter cfguard codegen core coroutines \
coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver \
dwarflinker engine executionengine extensions frontendopenmp fuzzmutate globalisel instcombine instrumentation interpreter \
dwarflinker engine executionengine extensions filecheck frontendopenacc frontendopenmp fuzzmutate globalisel \
instcombine instrumentation interfacestub interpreter \
ipo irreader jitlink libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mirparser native \
nativecodegen objcarcopts object objectyaml option orcerror orcjit passes profiledata remarks runtimedyld \
nativecodegen objcarcopts object objectyaml option orcjit orcshared orctargetprocess passes profiledata remarks runtimedyld \
scalaropts selectiondag support symbolize tablegen target textapi transformutils vectorize webassembly \
webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest \
x86 x86asmparser x86codegen x86desc x86disassembler x86info xray"
static_libs="-lLLVMXRay -lLLVMWindowsManifest -lLLVMTableGen -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMOrcJIT \
-lLLVMOrcError -lLLVMJITLink -lLLVMObjectYAML -lLLVMMIRParser -lLLVMMCA -lLLVMLTO -lLLVMPasses -lLLVMCoroutines \
-lLLVMObjCARCOpts -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser \
-lLLVMFrontendOpenMP -lLLVMExtensions -lLLVMLineEditor -lLLVMLibDriver -lLLVMInterpreter -lLLVMFuzzMutate -lLLVMMCJIT \
-lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMDWARFLinker -lLLVMDlltoolDriver -lLLVMOption -lLLVMDebugInfoGSYM \
-lLLVMCoverage -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info \
-lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyAsmParser \
-lLLVMWebAssemblyInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMUtils \
-lLLVMARMInfo -lLLVMAArch64Disassembler -lLLVMMCDisassembler -lLLVMAArch64CodeGen -lLLVMCFGuard -lLLVMGlobalISel \
-lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoDWARF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts \
-lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData \
-lLLVMObject -lLLVMTextAPI -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMAArch64AsmParser \
-lLLVMMCParser -lLLVMAArch64Desc -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBinaryFormat \
-lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMSupport -lLLVMDemangle"
static_libs="-lLLVMWindowsManifest -lLLVMTableGen -lLLVMLTO -lLLVMPasses -lLLVMCoroutines \
-lLLVMObjCARCOpts -lLLVMExtensions -lLLVMLibDriver -lLLVMOption -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize \
-lLLVMLinker -lLLVMIRReader -lLLVMFrontendOpenMP -lLLVMDebugInfoPDB -lLLVMAsmParser -lLLVMX86Disassembler \
-lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser \
-lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyInfo -lLLVMARMDisassembler -lLLVMARMAsmParser \
-lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAArch64Disassembler -lLLVMMCDisassembler \
-lLLVMAArch64AsmParser -lLLVMAArch64CodeGen -lLLVMCFGuard -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter \
-lLLVMDebugInfoDWARF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine \
-lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMTextAPI -lLLVMMCParser \
-lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMAArch64Desc -lLLVMMC -lLLVMDebugInfoCodeView \
-lLLVMDebugInfoMSF -lLLVMBinaryFormat -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMSupport -lLLVMDemangle"
shared_libs="-lLLVM-$version"
libs=$shared_libs
handle_args () {
Expand Down
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,15 @@ include(HandleLTOPGOBuildOptions)
#
# Enable Dynamic compilation if supported for this platform and LLVM version.
#
set(LDC_DYNAMIC_COMPILE "AUTO" CACHE STRING "Support dynamic compilation (ON|OFF). Enabled by default.")
set(LDC_DYNAMIC_COMPILE "AUTO" CACHE STRING "Support dynamic compilation (ON|OFF). Enabled by default; not supported for LLVM >= 12.")
option(LDC_DYNAMIC_COMPILE_USE_CUSTOM_PASSES "Use custom LDC passes in jit" ON)
if(LDC_DYNAMIC_COMPILE STREQUAL "AUTO")
set(LDC_DYNAMIC_COMPILE ON)
if(LDC_LLVM_VER LESS 1200)
set(LDC_DYNAMIC_COMPILE ON)
else()
# TODO: port from ORCv1 API (dropped with LLVM 12) to ORCv2 (added with LLVM 7)
set(LDC_DYNAMIC_COMPILE OFF)
endif()
endif()
message(STATUS "-- Building LDC with dynamic compilation support (LDC_DYNAMIC_COMPILE): ${LDC_DYNAMIC_COMPILE}")
if(LDC_DYNAMIC_COMPILE)
Expand Down Expand Up @@ -595,10 +600,15 @@ if(LDC_WITH_LLD)
set(LDC_LINKERFLAG_LIST -lLLVMSymbolize ${LDC_LINKERFLAG_LIST})
endif()
endif()
if (LDC_LLVM_VER LESS 1200)
set(LLD_MACHO lldMachO)
else()
set(LLD_MACHO lldMachO2)
endif()
if(MSVC)
list(APPEND LDC_LINKERFLAG_LIST lldDriver.lib lldMinGW.lib lldCOFF.lib lldELF.lib lldMachO.lib lldWasm.lib lldYAML.lib lldReaderWriter.lib lldCommon.lib lldCore.lib)
list(APPEND LDC_LINKERFLAG_LIST lldDriver.lib lldMinGW.lib lldCOFF.lib lldELF.lib ${LLD_MACHO}.lib lldWasm.lib lldYAML.lib lldReaderWriter.lib lldCommon.lib lldCore.lib)
else()
set(LDC_LINKERFLAG_LIST -llldDriver -llldMinGW -llldCOFF -llldELF -llldMachO -llldWasm -llldYAML -llldReaderWriter -llldCommon -llldCore ${LDC_LINKERFLAG_LIST})
set(LDC_LINKERFLAG_LIST -llldDriver -llldMinGW -llldCOFF -llldELF -l${LLD_MACHO} -llldWasm -llldYAML -llldReaderWriter -llldCommon -llldCore ${LDC_LINKERFLAG_LIST})
endif()
if(APPLE AND LDC_LLVM_VER LESS 700) # LLVM 6.0.0 bug, should be fixed in 6.0.1
list(APPEND LDC_LINKERFLAG_LIST -lxml2)
Expand Down
3 changes: 2 additions & 1 deletion cmake/Modules/FindLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
# system default locations such as /usr/local/bin. Executing find_program()
# multiples times is the approach recommended in the docs.
set(llvm_config_names llvm-config-11.0 llvm-config110 llvm-config-11
set(llvm_config_names llvm-config-12.0 llvm-config120 llvm-config-12
llvm-config-11.0 llvm-config110 llvm-config-11
llvm-config-10.0 llvm-config100 llvm-config-10
llvm-config-9.0 llvm-config90 llvm-config-9
llvm-config-8.0 llvm-config80 llvm-config-8
Expand Down
12 changes: 9 additions & 3 deletions driver/cl_options-llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

#include "driver/cl_options-llvm.h"

#if LDC_WITH_LLD
#include "llvm/ADT/Triple.h"
#endif

// Pull in command-line options and helper functions from special LLVM header
// shared by multiple LLVM tools.
#if LDC_LLVM_VER >= 1100
Expand Down Expand Up @@ -95,8 +99,10 @@ bool printTargetFeaturesHelp() {
[](const std::string &a) { return a == "help"; });
}

TargetOptions InitTargetOptionsFromCodeGenFlags() {
#if LDC_LLVM_VER >= 1100
TargetOptions InitTargetOptionsFromCodeGenFlags(const llvm::Triple &triple) {
#if LDC_LLVM_VER >= 1200
return codegen::InitTargetOptionsFromCodeGenFlags(triple);
#elif LDC_LLVM_VER >= 1100
return codegen::InitTargetOptionsFromCodeGenFlags();
#else
return ::InitTargetOptionsFromCodeGenFlags();
Expand Down Expand Up @@ -141,7 +147,7 @@ TargetOptions initTargetOptionsFromCodeGenFlags() {
#else
TargetOptions InitTargetOptionsFromCodeGenFlags() {
#endif
return ::opts::InitTargetOptionsFromCodeGenFlags();
return ::opts::InitTargetOptionsFromCodeGenFlags(llvm::Triple());
}

#if LDC_LLVM_VER >= 1000
Expand Down
5 changes: 4 additions & 1 deletion driver/cl_options-llvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace llvm {
class Function;
class Triple;
}

namespace opts {
Expand All @@ -32,7 +33,9 @@ llvm::cl::boolOrDefault disableFPElim();
bool disableRedZone();
bool printTargetFeaturesHelp();

llvm::TargetOptions InitTargetOptionsFromCodeGenFlags();
llvm::TargetOptions
InitTargetOptionsFromCodeGenFlags(const llvm::Triple &triple);

std::string getCPUStr();
std::string getFeaturesStr();
#if LDC_LLVM_VER >= 1000
Expand Down
49 changes: 35 additions & 14 deletions driver/cl_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,18 +702,29 @@ void createClashingOptions() {
/// to be useful for end users from the -help output.
void hideLLVMOptions() {
static const char *const hiddenOptions[] = {
"aarch64-neon-syntax", "addrsig", "arm-add-build-attributes",
"aarch64-neon-syntax", "abort-on-max-devirt-iterations-reached",
"addrsig", "amdgpu-bypass-slow-div", "amdgpu-disable-loop-alignment",
"amdgpu-disable-power-sched", "amdgpu-dpp-combine",
"amdgpu-dump-hsa-metadata", "amdgpu-enable-flat-scratch",
"amdgpu-enable-global-sgpr-addr", "amdgpu-enable-merge-m0",
"amdgpu-promote-alloca-to-vector-limit",
"amdgpu-reserve-vgpr-for-sgpr-spill", "amdgpu-sdwa-peephole",
"amdgpu-use-aa-in-codegen", "amdgpu-verify-hsa-metadata",
"amdgpu-vgpr-index-mode", "arm-add-build-attributes",
"arm-implicit-it", "asm-instrumentation", "asm-show-inst",
"atomic-counter-update-promoted", "atomic-first-counter",
"basic-block-sections",
"basicblock-sections", "bounds-checking-single-trap",
"cfg-hide-deoptimize-paths", "cfg-hide-unreachable-paths",
"code-model", "cost-kind", "cppfname", "cppfor", "cppgen",
"cvp-dont-add-nowrap-flags",
"cvp-dont-process-adds", "debug-counter", "debug-entry-values",
"debugger-tune", "debugify-level", "debugify-quiet",
"denormal-fp-math", "denormal-fp-math-f32", "disable-debug-info-verifier",
"disable-objc-arc-checkforcfghazards", "disable-spill-fusing",
"do-counter-promotion", "dwarf64", "emit-call-site-info",
"disable-objc-arc-checkforcfghazards", "disable-promote-alloca-to-lds",
"disable-promote-alloca-to-vector", "disable-slp-vectorization",
"disable-spill-fusing",
"do-counter-promotion", "dot-cfg-mssa", "dwarf64", "emit-call-site-info",
"emscripten-cxx-exceptions-allowed",
"emscripten-cxx-exceptions-whitelist",
"emulated-tls", "enable-correct-eh-support",
Expand All @@ -727,27 +738,29 @@ void hideLLVMOptions() {
"enable-no-nans-fp-math", "enable-no-signed-zeros-fp-math",
"enable-no-trapping-fp-math", "enable-objc-arc-annotations",
"enable-objc-arc-opts", "enable-pie", "enable-scoped-noalias",
"enable-split-backedge-in-load-pre",
"enable-tbaa", "enable-unsafe-fp-math", "exception-model",
"exhaustive-register-search", "expensive-combines",
"experimental-debug-variable-locations",
"fatal-assembler-warnings", "filter-print-funcs",
"force-dwarf-frame-section", "gpsize", "hash-based-counter-split",
"hot-cold-split",
"hot-cold-split", "ignore-xcoff-visibility",
"imp-null-check-page-size", "imp-null-max-insts-to-consider",
"import-all-index", "incremental-linker-compatible",
"instcombine-code-sinking", "instcombine-guard-widening-window",
"instcombine-max-iterations", "instcombine-max-num-phis",
"instcombine-maxarray-size", "instcombine-negator-enabled",
"instcombine-negator-max-depth",
"instcombine-negator-max-depth", "instcombine-unsafe-select-transform",
"instrprof-atomic-counter-update-all", "internalize-public-api-file",
"internalize-public-api-list", "iterative-counter-promotion",
"join-liveintervals", "jump-table-type", "limit-float-precision",
"lto-embed-bitcode", "matrix-default-layout", "matrix-propagate-shape",
"max-counter-promotions", "max-counter-promotions-per-loop",
"mc-relax-all", "mc-x86-disable-arith-relaxation", "meabi",
"memop-size-large", "memop-size-range", "merror-missing-parenthesis",
"merror-noncontigious-register", "mfuture-regs", "mips-compact-branches",
"mips16-constant-islands", "mips16-hard-float", "mir-strip-debugify-only",
"mlsm", "mno-compound",
"merror-noncontigious-register", "mfuture-regs", "mhvx",
"mips-compact-branches", "mips16-constant-islands", "mips16-hard-float",
"mir-strip-debugify-only", "mlsm", "mno-compound",
"mno-fixup", "mno-ldc1-sdc1", "mno-pairing", "mwarn-missing-parenthesis",
"mwarn-noncontigious-register", "mwarn-sign-mismatch",
"no-discriminators", "no-xray-index",
Expand All @@ -759,34 +772,42 @@ void hideLLVMOptions() {
"print-before-all", "print-machineinstrs", "print-module-scope",
"profile-estimator-loop-weight", "profile-estimator-loop-weight",
"profile-file", "profile-info-file", "profile-verifier-noassert",
"pseudo-probe-for-profiling",
"r600-ir-structurize", "rdf-dump", "rdf-limit", "recip", "regalloc",
"relax-elf-relocations", "remarks-section", "rewrite-map-file", "rng-seed",
"runtime-counter-relocation", "safepoint-ir-verifier-print-only",
"sample-profile-check-record-coverage",
"sample-profile-check-sample-coverage",
"sample-profile-inline-hot-threshold",
"sample-profile-max-propagate-iterations", "shrink-wrap", "simplify-mir",
"skip-ret-exit-block",
"speculative-counter-promotion-max-exiting",
"speculative-counter-promotion-to-loop", "spiller", "spirv-debug",
"spirv-erase-cl-md", "spirv-lower-const-expr", "spirv-mem2reg",
"spirv-no-deref-attr", "spirv-text",
"spv-lower-saddwithoverflow-validate", "spvbool-validate",
"spvmemmove-validate",
"stack-alignment", "stack-size-section", "stack-symbol-ordering",
"spirv-no-deref-attr", "spirv-text", "spirv-verify-regularize-passes",
"split-machine-functions", "spv-lower-saddwithoverflow-validate",
"spvbool-validate", "spvmemmove-validate",
"stack-alignment", "stack-protector-guard",
"stack-protector-guard-offset", "stack-protector-guard-reg",
"stack-size-section", "stack-symbol-ordering",
"stackmap-version", "static-func-full-module-prefix",
"static-func-strip-dirname-prefix", "stats", "stats-json", "strip-debug",
"struct-path-tbaa", "summary-file", "tail-predication", "tailcallopt",
"thinlto-assume-merged",
"thread-model", "time-passes", "time-trace-granularity", "tls-size",
"unfold-element-atomic-memcpy-max-elements", "unique-bb-section-names",
"unfold-element-atomic-memcpy-max-elements",
"unique-basic-block-section-names", "unique-bb-section-names",
"unique-section-names", "unit-at-a-time", "use-ctors",
"verify-debug-info", "verify-dom-info", "verify-loop-info",
"vec-extabi", "verify-debug-info", "verify-dom-info",
"verify-legalizer-debug-locs", "verify-loop-info",
"verify-loop-lcssa", "verify-machine-dom-info", "verify-regalloc",
"verify-region-info", "verify-scev", "verify-scev-maps",
"vp-counters-per-site", "vp-static-alloc",
"x86-align-branch", "x86-align-branch-boundary",
"x86-branches-within-32B-boundaries", "x86-early-ifcvt",
"x86-pad-max-prefix-size",
"x86-recip-refinement-steps", "x86-use-vzeroupper",
"xcoff-traceback-table",

// We enable -fdata-sections/-ffunction-sections by default where it makes
// sense for reducing code size, so hide them to avoid confusion.
Expand Down
8 changes: 8 additions & 0 deletions driver/codegenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
#include "llvm/Support/Path.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/YAMLTraits.h"
#if LDC_MLIR_ENABLED
#if LDC_LLVM_VER >= 1200
#include "mlir/IR/BuiltinOps.h"
#else
#include "mlir/IR/Module.h"
#endif
#include "mlir/IR/MLIRContext.h"
#endif

namespace {

Expand Down
17 changes: 10 additions & 7 deletions driver/codegenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,23 @@
#pragma once

#include "gen/irstate.h"
#if LDC_MLIR_ENABLED
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Module.h"

#if LDC_MLIR_ENABLED
namespace mlir {
class MLIRContext;
class OwningModuleRef;
}
#endif

namespace ldc {

class CodeGenerator {
public:
CodeGenerator(llvm::LLVMContext &context,
#if LDC_MLIR_ENABLED
mlir::MLIRContext &mlirContext,
CodeGenerator(llvm::LLVMContext &context,
#if LDC_MLIR_ENABLED
mlir::MLIRContext &mlirContext,
#endif
bool singleObj);
bool singleObj);

~CodeGenerator();
void emit(Module *m);
Expand Down
12 changes: 8 additions & 4 deletions driver/linker-gcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,13 +745,17 @@ int linkObjToBinaryGcc(llvm::StringRef outputPath,
#endif
);
} else if (global.params.targetTriple->isOSBinFormatMachO()) {
#if LDC_LLVM_VER >= 1200
success = lld::macho::link(fullArgs
#else
success = lld::mach_o::link(fullArgs
#endif
#if LDC_LLVM_VER >= 700
,
CanExitEarly
,
CanExitEarly
#if LDC_LLVM_VER >= 1000
,
llvm::outs(), llvm::errs()
,
llvm::outs(), llvm::errs()
#endif
#endif
);
Expand Down
3 changes: 3 additions & 0 deletions driver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Target/TargetMachine.h"
#if LDC_MLIR_ENABLED
#include "mlir/IR/MLIRContext.h"
#endif
#include <assert.h>
#include <limits.h>
#include <stdio.h>
Expand Down
4 changes: 3 additions & 1 deletion driver/targetmachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,9 @@ createTargetMachine(const std::string targetTriple, const std::string arch,
}
}

llvm::TargetOptions targetOptions = opts::InitTargetOptionsFromCodeGenFlags();
llvm::TargetOptions targetOptions =
opts::InitTargetOptionsFromCodeGenFlags(triple);

if (targetOptions.MCOptions.ABIName.empty())
targetOptions.MCOptions.ABIName = getABI(triple);

Expand Down
13 changes: 6 additions & 7 deletions gen/dibuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ DIBuilder::DIBuilder(IRState *const IR)
// (https://reviews.llvm.org/D23720)
emitColumnInfo(opts::getFlagOrDefault(::emitColumnInfo, !emitCodeView)) {}

llvm::LLVMContext &DIBuilder::getContext() { return IR->context(); }

unsigned DIBuilder::getColumn(const Loc &loc) const {
return (loc.linnum && emitColumnInfo) ? loc.charnum : 0;
}
Expand Down Expand Up @@ -193,16 +191,16 @@ llvm::StringRef DIBuilder::GetNameAndScope(Dsymbol *sym, DIScope &scope) {
// Sets the memory address for a debuginfo variable.
void DIBuilder::Declare(const Loc &loc, llvm::Value *storage,
DILocalVariable divar, DIExpression diexpr) {
auto debugLoc =
llvm::DebugLoc::get(loc.linnum, getColumn(loc), GetCurrentScope());
auto debugLoc = llvm::DILocation::get(IR->context(), loc.linnum,
getColumn(loc), GetCurrentScope());
DBuilder.insertDeclare(storage, divar, diexpr, debugLoc, IR->scopebb());
}

// Sets the (current) value for a debuginfo variable.
void DIBuilder::SetValue(const Loc &loc, llvm::Value *value,
DILocalVariable divar, DIExpression diexpr) {
auto debugLoc =
llvm::DebugLoc::get(loc.linnum, getColumn(loc), GetCurrentScope());
auto debugLoc = llvm::DILocation::get(IR->context(), loc.linnum,
getColumn(loc), GetCurrentScope());
DBuilder.insertDbgValueIntrinsic(value, divar, diexpr, debugLoc,
IR->scopebb());
}
Expand Down Expand Up @@ -1202,8 +1200,9 @@ void DIBuilder::EmitStopPoint(const Loc &loc) {
unsigned col = getColumn(loc);
Logger::println("D to dwarf stoppoint at line %u, column %u", linnum, col);
LOG_SCOPE;

IR->ir->SetCurrentDebugLocation(
llvm::DebugLoc::get(linnum, col, GetCurrentScope()));
llvm::DILocation::get(IR->context(), linnum, col, GetCurrentScope()));
}

void DIBuilder::EmitValue(llvm::Value *val, VarDeclaration *vd) {
Expand Down
1 change: 0 additions & 1 deletion gen/dibuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ class DIBuilder {
void Finalize();

private:
llvm::LLVMContext &getContext();
DIScope GetSymbolScope(Dsymbol *s);
DIScope GetCurrentScope();
llvm::StringRef GetNameAndScope(Dsymbol *sym, DIScope &scope);
Expand Down
Loading