Certain multi-platform languages, such as OpenCL, have the concept of

address spaces which is both (1) a "semantic" concept and
(2) possibly a hardware level restriction. It is desirable to
be able to discard/merge the LLVM-level address spaces on arguments for which
there is no difference to the current backend while keeping
track of the semantic address spaces in a funciton prototype. To do this
enable addition of the address space into the name-mangling process. Add
some tests to document this behaviour against inadvertent changes.

Patch by Michele Scandale!

llvm-svn: 190684
This commit is contained in:
David Tweed
2013-09-13 12:04:22 +00:00
parent 3c0e5567a9
commit 31d09b0cef
12 changed files with 123 additions and 9 deletions

View File

@@ -1329,6 +1329,28 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack);
Opts.CurrentModule = Args.getLastArgValue(OPT_fmodule_name);
if (Arg *A = Args.getLastArg(OPT_faddress_space_map_mangling_EQ)) {
switch (llvm::StringSwitch<unsigned>(A->getValue())
.Case("target", LangOptions::ASMM_Target)
.Case("no", LangOptions::ASMM_Off)
.Case("yes", LangOptions::ASMM_On)
.Default(255)) {
default:
Diags.Report(diag::err_drv_invalid_value)
<< "-faddress-space-map-mangling=" << A->getValue();
break;
case LangOptions::ASMM_Target:
Opts.setAddressSpaceMapMangling(LangOptions::ASMM_Target);
break;
case LangOptions::ASMM_On:
Opts.setAddressSpaceMapMangling(LangOptions::ASMM_On);
break;
case LangOptions::ASMM_Off:
Opts.setAddressSpaceMapMangling(LangOptions::ASMM_Off);
break;
}
}
// Check if -fopenmp is specified.
Opts.OpenMP = Args.hasArg(OPT_fopenmp);