[pkg-d-commits] [ldc] 08/95: Support -mcpu switch in LDMD
Matthias Klumpp
mak at moszumanska.debian.org
Thu Jul 13 20:53:55 UTC 2017
This is an automated email from the git hooks/post-receive script.
mak pushed a commit to annotated tag v1.3.0-beta1
in repository ldc.
commit f34b8abff0794bead4819cc44feb8625c4220658
Author: Martin <noone at nowhere.com>
Date: Sat Feb 18 23:46:30 2017 +0100
Support -mcpu switch in LDMD
Ignore `-mcpu=baseline`, forward `-mcpu=native` to LDC and translate
`-mcpu=avx` to `-mattr=+avx`. Show LLVM's (extensive) help for `-mcpu=?`
(which is sadly actually printed 3 consecutive times).
---
driver/ldmd.cpp | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/driver/ldmd.cpp b/driver/ldmd.cpp
index 905a8cb..a87c75d 100644
--- a/driver/ldmd.cpp
+++ b/driver/ldmd.cpp
@@ -207,8 +207,12 @@ Where:\n\
-main add default main() (e.g. for unittesting)\n\
-man open web browser on manual page\n"
#if 0
-" -map generate linker .map file\n\
- -mscrtlib=<name> MS C runtime library to reference from main/WinMain/DllMain\n"
+" -map generate linker .map file\n"
+#endif
+" -mcpu=<id> generate instructions for architecture identified by 'id'\n\
+ -mcpu=? list all architecture options\n"
+#if 0
+" -mscrtlib=<name> MS C runtime library to reference from main/WinMain/DllMain\n"
#endif
" -noboundscheck no array bounds checking (deprecated, use -boundscheck=off)\n\
-O optimize\n\
@@ -435,6 +439,20 @@ void translateArgs(size_t originalArgc, char **originalArgv,
} else {
goto Lerror;
}
+ } else if (strcmp(p + 1, "mcpu=?") == 0) {
+ const char *mcpuargs[] = {ldcPath.c_str(), "-mcpu=help", nullptr};
+ execute(ldcPath, mcpuargs);
+ exit(EXIT_SUCCESS);
+ } else if (memcmp(p + 1, "mcpu=", 5) == 0) {
+ if (strcmp(p + 6, "baseline") == 0) {
+ // ignore
+ } else if (strcmp(p + 6, "avx") == 0) {
+ ldcArgs.push_back("-mattr=+avx");
+ } else if (strcmp(p + 6, "native") == 0) {
+ ldcArgs.push_back(p);
+ } else {
+ goto Lerror;
+ }
} else if (strcmp(p + 1, "transition=?") == 0) {
const char *transitionargs[] = {ldcPath.c_str(), p, nullptr};
execute(ldcPath, transitionargs);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git
More information about the pkg-d-commits
mailing list