Skip to content

Commit bdc5794

Browse files
committed
Merge from 'master' to 'sycl-web' (#10)
CONFLICT (content): Merge conflict in clang/test/Preprocessor/sycl-macro.cpp CONFLICT (content): Merge conflict in clang/test/Driver/sycl.c CONFLICT (content): Merge conflict in clang/lib/Frontend/CompilerInvocation.cpp CONFLICT (content): Merge conflict in clang/lib/Driver/ToolChains/Clang.cpp CONFLICT (content): Merge conflict in clang/include/clang/Basic/LangOptions.def
2 parents 08318b7 + 740ed61 commit bdc5794

File tree

109 files changed

+3562
-2042
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+3562
-2042
lines changed

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ LANGOPT(OpenCL , 1, 0, "OpenCL")
204204
LANGOPT(OpenCLVersion , 32, 0, "OpenCL C version")
205205
LANGOPT(OpenCLCPlusPlus , 1, 0, "C++ for OpenCL")
206206
LANGOPT(OpenCLCPlusPlusVersion , 32, 0, "C++ for OpenCL version")
207+
ENUM_LANGOPT(SYCLVersion, SYCLVersionList, 4, SYCLVersionList::undefined, "Version of the SYCL standard used")
207208
LANGOPT(NativeHalfType , 1, 0, "Native half type support")
208209
LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
209210
LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
@@ -230,13 +231,11 @@ LANGOPT(GPURelocatableDeviceCode, 1, 0, "generate relocatable device code")
230231
LANGOPT(GPUAllowDeviceInit, 1, 0, "allowing device side global init functions for HIP")
231232
LANGOPT(GPUMaxThreadsPerBlock, 32, 256, "default max threads per block for kernel launch bounds for HIP")
232233

233-
LANGOPT(SYCL , 1, 0, "SYCL")
234234
LANGOPT(SYCLIsDevice , 1, 0, "Generate code for SYCL device")
235235
LANGOPT(SYCLIsHost , 1, 0, "SYCL host compilation")
236236
LANGOPT(SYCLAllowFuncPtr , 1, 0, "Allow function pointers in SYCL device code")
237237
LANGOPT(SYCLStdLayoutKernelParams, 1, 0, "Enable standard layout requirement for SYCL kernel parameters")
238238
LANGOPT(SYCLUnnamedLambda , 1, 0, "Allow unnamed lambda SYCL kernels")
239-
LANGOPT(SYCLVersion , 32, 0, "Version of the SYCL standard used")
240239

241240
LANGOPT(HIPUseNewLaunchAPI, 1, 0, "Use new kernel launching API for HIP")
242241

clang/include/clang/Driver/Options.td

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,8 @@ def cl_no_signed_zeros : Flag<["-"], "cl-no-signed-zeros">, Group<opencl_Group>,
545545
HelpText<"OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.">;
546546
def cl_std_EQ : Joined<["-"], "cl-std=">, Group<opencl_Group>, Flags<[CC1Option]>,
547547
HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,clc++,CLC++">;
548+
def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>, Flags<[CC1Option]>,
549+
HelpText<"SYCL language standard to compile for.">, Values<"1.2.1">;
548550
def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">, Group<opencl_Group>,
549551
HelpText<"OpenCL only. Allow denormals to be flushed to zero.">;
550552
def cl_fp32_correctly_rounded_divide_sqrt : Flag<["-"], "cl-fp32-correctly-rounded-divide-sqrt">, Group<opencl_Group>, Flags<[CC1Option]>,
@@ -3477,13 +3479,10 @@ defm underscoring : BooleanFFlag<"underscoring">, Group<gfortran_Group>;
34773479
defm whole_file : BooleanFFlag<"whole-file">, Group<gfortran_Group>;
34783480

34793481
// C++ SYCL options
3480-
def fsycl : Flag<["-"], "fsycl">, Group<sycl_Group>, Flags<[CC1Option, CoreOption]>,
3482+
def fsycl : Flag<["-"], "fsycl">, Group<sycl_Group>, Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
34813483
HelpText<"Enable SYCL kernels compilation for device">;
3482-
def fno_sycl : Flag<["-"], "fno-sycl">, Group<sycl_Group>, Flags<[CoreOption]>,
3483-
HelpText<"Disable SYCL kernels compilation for device">;
3484-
def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>, Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
3485-
HelpText<"SYCL language standard to compile for.">, Values<"2017, 121, 1.2.1, sycl-1.2.1">;
3486-
3484+
def fno_sycl : Flag<["-"], "fno-sycl">, Group<sycl_Group>,
3485+
HelpText<"Disable SYCL kernels compilation for device">, Flags<[NoArgumentUnused, CoreOption]>;
34873486
def reuse_exe_EQ : Joined<["-"], "reuse-exe=">,
34883487
HelpText<"Speed up FPGA aoc compile if the device code in <exe> is unchanged.">,
34893488
MetaVarName<"<exe>">;

clang/lib/AST/Mangle.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ enum CCMangling {
5050
CCM_Fast,
5151
CCM_RegCall,
5252
CCM_Vector,
53-
CCM_Std
53+
CCM_Std,
54+
CCM_WasmMainArgcArgv
5455
};
5556

5657
static bool isExternC(const NamedDecl *ND) {
@@ -63,6 +64,16 @@ static CCMangling getCallingConvMangling(const ASTContext &Context,
6364
const NamedDecl *ND) {
6465
const TargetInfo &TI = Context.getTargetInfo();
6566
const llvm::Triple &Triple = TI.getTriple();
67+
68+
// On wasm, the argc/argv form of "main" is renamed so that the startup code
69+
// can call it with the correct function signature.
70+
// On Emscripten, users may be exporting "main" and expecting to call it
71+
// themselves, so we can't mangle it.
72+
if (Triple.isWasm() && !Triple.isOSEmscripten())
73+
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND))
74+
if (FD->isMain() && FD->hasPrototype() && FD->param_size() == 2)
75+
return CCM_WasmMainArgcArgv;
76+
6677
if (!Triple.isOSWindows() || !Triple.isX86())
6778
return CCM_Other;
6879

@@ -143,6 +154,12 @@ void MangleContext::mangleName(const NamedDecl *D, raw_ostream &Out) {
143154

144155
const ASTContext &ASTContext = getASTContext();
145156
CCMangling CC = getCallingConvMangling(ASTContext, D);
157+
158+
if (CC == CCM_WasmMainArgcArgv) {
159+
Out << "__main_argc_argv";
160+
return;
161+
}
162+
146163
bool MCXX = shouldMangleCXXName(D);
147164
const TargetInfo &TI = Context.getTargetInfo();
148165
if (CC == CCM_Other || (MCXX && TI.getCXXABI() == TargetCXXABI::Microsoft)) {

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@ void CodeGenModule::Release() {
464464
CodeGenFunction(*this).EmitCfiCheckStub();
465465
}
466466
emitAtAvailableLinkGuard();
467+
if (Context.getTargetInfo().getTriple().isWasm() &&
468+
!Context.getTargetInfo().getTriple().isOSEmscripten()) {
469+
EmitMainVoidAlias();
470+
}
467471
emitLLVMUsed();
468472
if (SanStats)
469473
SanStats->finish();
@@ -5807,6 +5811,17 @@ void CodeGenModule::EmitDeferredUnusedCoverageMappings() {
58075811
}
58085812
}
58095813

5814+
void CodeGenModule::EmitMainVoidAlias() {
5815+
// In order to transition away from "__original_main" gracefully, emit an
5816+
// alias for "main" in the no-argument case so that libc can detect when
5817+
// new-style no-argument main is in used.
5818+
if (llvm::Function *F = getModule().getFunction("main")) {
5819+
if (!F->isDeclaration() && F->arg_size() == 0 && !F->isVarArg() &&
5820+
F->getReturnType()->isIntegerTy(Context.getTargetInfo().getIntWidth()))
5821+
addUsedGlobal(llvm::GlobalAlias::create("__main_void", F));
5822+
}
5823+
}
5824+
58105825
/// Turns the given pointer into a constant.
58115826
static llvm::Constant *GetPointerConstant(llvm::LLVMContext &Context,
58125827
const void *Ptr) {

clang/lib/CodeGen/CodeGenModule.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,9 @@ class CodeGenModule : public CodeGenTypeCache {
10361036
/// for the uninstrumented functions.
10371037
void EmitDeferredUnusedCoverageMappings();
10381038

1039+
/// Emit an alias for "main" if it has no arguments (needed for wasm).
1040+
void EmitMainVoidAlias();
1041+
10391042
/// Tell the consumer that this variable has been instantiated.
10401043
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD);
10411044

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4080,7 +4080,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
40804080

40814081
if (UseSYCLTriple) {
40824082
// We want to compile sycl kernels.
4083-
CmdArgs.push_back("-fsycl");
40844083
CmdArgs.push_back("-fsycl-is-device");
40854084
// Pass the triple of host when doing SYCL
40864085
auto AuxT = llvm::Triple(llvm::sys::getProcessTriple());
@@ -4120,7 +4119,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
41204119
CmdArgs.push_back("-fsycl-std-layout-kernel-params");
41214120
} else if (IsSYCL) {
41224121
// Ensure the default version in SYCL mode is 1.2.1
4123-
CmdArgs.push_back("-sycl-std=2017");
4122+
CmdArgs.push_back("-sycl-std=1.2.1");
41244123
}
41254124

41264125
if (IsOpenMPDevice) {

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,22 +2538,22 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
25382538
LangStd = OpenCLLangStd;
25392539
}
25402540

2541-
Opts.SYCL = Args.hasArg(options::OPT_fsycl);
2542-
Opts.SYCLIsDevice = Opts.SYCL && Args.hasArg(options::OPT_fsycl_is_device);
2543-
if (Opts.SYCL) {
2544-
// -sycl-std applies to any SYCL source, not only those containing kernels,
2545-
// but also those using the SYCL API
2546-
if (const Arg *A = Args.getLastArg(OPT_sycl_std_EQ)) {
2547-
Opts.SYCLVersion = llvm::StringSwitch<unsigned>(A->getValue())
2548-
.Cases("2017", "1.2.1", "121", "sycl-1.2.1", 2017)
2549-
.Default(0U);
2550-
2551-
if (Opts.SYCLVersion == 0U) {
2552-
// User has passed an invalid value to the flag, this is an error
2553-
Diags.Report(diag::err_drv_invalid_value)
2554-
<< A->getAsString(Args) << A->getValue();
2555-
}
2541+
// -sycl-std applies to any SYCL source, not only those containing kernels,
2542+
// but also those using the SYCL API
2543+
if(const Arg *A = Args.getLastArg(OPT_sycl_std_EQ)) {
2544+
Opts.setSYCLVersion(llvm::StringSwitch<LangOptions::SYCLVersionList>(A->getValue())
2545+
.Cases("1.2.1", "121", "sycl-1.2.1", LangOptions::SYCLVersionList::sycl_1_2_1)
2546+
.Default(LangOptions::SYCLVersionList::undefined));
2547+
2548+
if (Opts.getSYCLVersion() == LangOptions::SYCLVersionList::undefined) {
2549+
// User has passed an invalid value to the flag, this is an error
2550+
Diags.Report(diag::err_drv_invalid_value)
2551+
<< A->getAsString(Args) << A->getValue();
25562552
}
2553+
} else if (Args.hasArg(options::OPT_fsycl_is_device)
2554+
|| Args.hasArg(options::OPT_fsycl_is_host)
2555+
|| Args.hasArg(options::OPT_fsycl)) {
2556+
Opts.setSYCLVersion(LangOptions::SYCLVersionList::sycl_1_2_1);
25572557
}
25582558

25592559
Opts.IncludeDefaultHeader = Args.hasArg(OPT_finclude_default_header);

clang/lib/Frontend/InitHeaderSearch.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,7 @@ void InitHeaderSearch::AddDefaultIncludePaths(const LangOptions &Lang,
433433
break;
434434

435435
case llvm::Triple::UnknownOS:
436-
if (triple.getArch() == llvm::Triple::wasm32 ||
437-
triple.getArch() == llvm::Triple::wasm64)
436+
if (triple.isWasm())
438437
return;
439438
break;
440439
}

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,15 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
461461
Builder.defineMacro("__FAST_RELAXED_MATH__");
462462
}
463463

464-
if (LangOpts.SYCL) {
465-
// SYCL Version is set to a value when building SYCL applications
466-
if (LangOpts.SYCLVersion == 2017)
464+
// SYCL Version is set to a value when building SYCL applications
465+
switch (LangOpts.getSYCLVersion()) {
466+
case LangOptions::SYCLVersionList::sycl_1_2_1:
467467
Builder.defineMacro("CL_SYCL_LANGUAGE_VERSION", "121");
468+
break;
469+
case LangOptions::SYCLVersionList::undefined:
470+
default:
471+
// This is not a SYCL source, nothing to add
472+
break;
468473
}
469474

470475
// Not "standard" per se, but available even with the -undef flag.

clang/test/CodeGen/wasm-call-main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %clang_cc1 -triple wasm32 -o - -emit-llvm %s | FileCheck %s
2+
3+
// Mangle argc/argv main even when it's not defined in this TU.
4+
5+
#include <stddef.h>
6+
7+
int main(int argc, char *argv[]);
8+
9+
int foo(void) {
10+
return main(0, NULL);
11+
}
12+
13+
// CHECK: call i32 @__main_argc_argv(

clang/test/CodeGen/wasm-main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %clang_cc1 -triple wasm32 -o - -emit-llvm %s | FileCheck %s
2+
3+
// Don't mangle the no-arg form of main.
4+
5+
int main(void) {
6+
return 0;
7+
}
8+
9+
// CHECK-LABEL: define i32 @main()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %clang_cc1 -triple wasm32 -o - -emit-llvm %s | FileCheck %s
2+
3+
// Mangle the argc/argv form of main.
4+
5+
int main(int argc, char **argv) {
6+
return 0;
7+
}
8+
9+
// CHECK-LABEL: define i32 @__main_argc_argv(i32 %argc, i8** %argv)

clang/test/Driver/sycl.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
// RUN: %clang -### -fsycl -c %s 2>&1 | FileCheck %s --check-prefix=ENABLED
22
// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
3-
// RUN: %clang -### -fsycl -sycl-std=1.2.1 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
4-
// RUN: %clang -### -fsycl -sycl-std=121 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
5-
// RUN: %clang -### -fsycl -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
6-
// RUN: %clang -### -fsycl -sycl-std=sycl-1.2.1 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
73
// RUN: %clang -### -fno-sycl -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
8-
// RUN: %clang -### -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=DISABLED
94
// RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
105
// RUN: %clangxx -### -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
116
// RUN: %clangxx -### -fsycl -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
127
// RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED
13-
// RUN: %clang_cl -### -fsycl -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
14-
// RUN: %clang_cl -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
15-
// RUN: %clang_cl -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED
168

179
// ENABLED: "-cc1"{{.*}} "-fsycl-is-device"
18-
// ENABLED-SAME: "-sycl-std={{[-.sycl0-9]+}}"
1910
// DISABLED-NOT: "-fsycl-is-device"
2011

2112
// RUN: %clang -### -fsycl-device-only -c %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 %s -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck %s
2-
// RUN: %clang_cc1 %s -fsycl -fsycl-is-device -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
2+
// RUN: %clang_cc1 %s -fsycl-is-device -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
33

44
// CHECK-NOT:#define __x86_64__ 1
55
// CHECK-SYCL:#define __x86_64__ 1
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// RUN: %clang_cc1 %s -E -dM | FileCheck %s
2-
// RUN: %clang_cc1 %s -fsycl -sycl-std=2017 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
3-
// RUN: %clang_cc1 %s -fsycl -fsycl-is-device -sycl-std=1.2.1 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
4-
// RUN: %clang_cc1 %s -fsycl -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
2+
// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
53
// RUN: %clang_cc1 %s -fsycl -E -dM | FileCheck --check-prefix=CHECK-ANY-SYCL %s
64
// RUN: %clang_cc1 %s -fsycl-is-device -E -dM -fms-compatibility | FileCheck --check-prefix=CHECK-MSVC %s
75
// CHECK-NOT:#define __SYCL_DEVICE_ONLY__ 1
@@ -13,5 +11,3 @@
1311
// CHECK-SYCL:#define SYCL_EXTERNAL __attribute__((sycl_device))
1412
// CHECK-MSVC-NOT: __GNUC__
1513
// CHECK-MSVC-NOT: __STDC__
16-
// CHECK-SYCL-STD:#define CL_SYCL_LANGUAGE_VERSION 121
17-
// CHECK-SYCL:#define __SYCL_DEVICE_ONLY__ 1

clang/test/SemaSYCL/kernel-attribute.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fsycl -fsycl-is-device -verify %s
1+
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fsycl-is-device -verify %s
22

33
// Only function templates
44
[[clang::sycl_kernel]] int gv2 = 0; // expected-warning {{'sycl_kernel' attribute only applies to function templates}}

lld/wasm/Symbols.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ std::string toString(const wasm::Symbol &sym) {
2929
}
3030

3131
std::string maybeDemangleSymbol(StringRef name) {
32+
// WebAssembly requires caller and callee signatures to match, so we mangle
33+
// `main` in the case where we need to pass it arguments.
34+
if (name == "__main_argc_argv")
35+
return "main";
3236
if (wasm::config->demangle)
3337
return demangleItanium(name);
3438
return std::string(name);

llvm/include/llvm/ADT/Triple.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,11 @@ class Triple {
754754
return getArch() == Triple::ve;
755755
}
756756

757+
/// Tests whether the target is wasm (32- and 64-bit).
758+
bool isWasm() const {
759+
return getArch() == Triple::wasm32 || getArch() == Triple::wasm64;
760+
}
761+
757762
/// Tests whether the target supports comdat
758763
bool supportsCOMDAT() const {
759764
return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());

llvm/include/llvm/Analysis/DependenceAnalysis.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,10 +924,28 @@ template <typename T> class ArrayRef;
924924
void updateDirection(Dependence::DVEntry &Level,
925925
const Constraint &CurConstraint) const;
926926

927+
/// Given a linear access function, tries to recover subscripts
928+
/// for each dimension of the array element access.
927929
bool tryDelinearize(Instruction *Src, Instruction *Dst,
928930
SmallVectorImpl<Subscript> &Pair);
929931

930-
private:
932+
/// Tries to delinearize access function for a fixed size multi-dimensional
933+
/// array, by deriving subscripts from GEP instructions. Returns true upon
934+
/// success and false otherwise.
935+
bool tryDelinearizeFixedSize(Instruction *Src, Instruction *Dst,
936+
const SCEV *SrcAccessFn,
937+
const SCEV *DstAccessFn,
938+
SmallVectorImpl<const SCEV *> &SrcSubscripts,
939+
SmallVectorImpl<const SCEV *> &DstSubscripts);
940+
941+
/// Tries to delinearize access function for a multi-dimensional array with
942+
/// symbolic runtime sizes.
943+
/// Returns true upon success and false otherwise.
944+
bool tryDelinearizeParametricSize(
945+
Instruction *Src, Instruction *Dst, const SCEV *SrcAccessFn,
946+
const SCEV *DstAccessFn, SmallVectorImpl<const SCEV *> &SrcSubscripts,
947+
SmallVectorImpl<const SCEV *> &DstSubscripts);
948+
931949
/// checkSubscript - Helper function for checkSrcSubscript and
932950
/// checkDstSubscript to avoid duplicate code
933951
bool checkSubscript(const SCEV *Expr, const Loop *LoopNest,

llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ class DWARFContext : public DIContext {
106106

107107
public:
108108
DWARFContext(std::unique_ptr<const DWARFObject> DObj,
109-
std::string DWPName = "");
109+
std::string DWPName = "",
110+
std::function<void(Error)> RecoverableErrorHandler =
111+
WithColor::defaultErrorHandler,
112+
std::function<void(Error)> WarningHandler =
113+
WithColor::defaultWarningHandler);
110114
~DWARFContext();
111115

112116
DWARFContext(DWARFContext &) = delete;
@@ -350,12 +354,19 @@ class DWARFContext : public DIContext {
350354

351355
static std::unique_ptr<DWARFContext>
352356
create(const object::ObjectFile &Obj, const LoadedObjectInfo *L = nullptr,
353-
function_ref<void(Error)> HandleError = WithColor::defaultErrorHandler,
354-
std::string DWPName = "");
357+
std::string DWPName = "",
358+
std::function<void(Error)> RecoverableErrorHandler =
359+
WithColor::defaultErrorHandler,
360+
std::function<void(Error)> WarningHandler =
361+
WithColor::defaultWarningHandler);
355362

356363
static std::unique_ptr<DWARFContext>
357364
create(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections,
358-
uint8_t AddrSize, bool isLittleEndian = sys::IsLittleEndianHost);
365+
uint8_t AddrSize, bool isLittleEndian = sys::IsLittleEndianHost,
366+
std::function<void(Error)> RecoverableErrorHandler =
367+
WithColor::defaultErrorHandler,
368+
std::function<void(Error)> WarningHandler =
369+
WithColor::defaultWarningHandler);
359370

360371
/// Loads register info for the architecture of the provided object file.
361372
/// Improves readability of dumped DWARF expressions. Requires the caller to

0 commit comments

Comments
 (0)