From 4a71579b757d3a2eb6902c84391f429838ad4912 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 30 Jan 2020 12:33:44 -0300 Subject: git subrepo clone https://git.savannah.gnu.org/git/lightning.git deps/lightning subrepo: subdir: "deps/lightning" merged: "b0b8eb5" upstream: origin: "https://git.savannah.gnu.org/git/lightning.git" branch: "master" commit: "b0b8eb5" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "a04d8c2" --- deps/lightning/size.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 deps/lightning/size.c (limited to 'deps/lightning/size.c') diff --git a/deps/lightning/size.c b/deps/lightning/size.c new file mode 100644 index 0000000..4e93370 --- /dev/null +++ b/deps/lightning/size.c @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2013-2019 Free Software Foundation, Inc. + * + * This file is part of GNU lightning. + * + * GNU lightning is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU lightning is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * Authors: + * Paulo Cesar Pereira de Andrade + */ + +#include +#include +#include +#include "lib/jit_names.c" + +jit_int16_t _szs[jit_code_last_code]; + +int +main(int argc, char *argv[]) +{ + FILE *fp; + jit_word_t offset; + int code, size, max; + + if ((fp = fopen(JIT_SIZE_PATH, "r")) == NULL) + exit(-1); + while (fscanf(fp, "%d %d\n", &code, &size) == 2) { + if (_szs[code] < size) + _szs[code] = size; + } + fclose(fp); + + max = 0; + for (offset = 0; offset < jit_code_last_code; offset++) + if (max < _szs[offset]) + max = _szs[offset]; + + if ((fp = fopen(JIT_SIZE_PATH, "w")) == NULL) + exit(-1); + + +#if __X64 || __X32 +# if __X64 + fprintf(fp, "#if __X64\n"); +# if __X64_32 + fprintf(fp, "# if __X64_32\n"); +# else + fprintf(fp, "# if !__X64_32\n"); +# endif +# else + fprintf(fp, "#if __X32\n"); +# endif +#else + fprintf(fp, "#if __WORDSIZE == %d\n", __WORDSIZE); +#endif +#if defined(__arm__) +# if defined(__ARM_PCS_VFP) + fprintf(fp, "#if defined(__ARM_PCS_VFP)\n"); +# else + fprintf(fp, "#if !defined(__ARM_PCS_VFP)\n"); +# endif +#elif defined(__mips__) +# if __WORDSIZE == 32 +# if NEW_ABI + fprintf(fp, "#if NEW_ABI\n"); +# else + fprintf(fp, "#if !NEW_ABI\n"); +# endif +# endif +#elif defined(__powerpc__) + fprintf(fp, "#if defined(__powerpc__)\n"); + fprintf(fp, "#if __BYTE_ORDER == %s\n", + __BYTE_ORDER == __BIG_ENDIAN ? "__BIG_ENDIAN" : "__LITTLE_ENDIAN"); +# if __WORDSIZE == 32 + fprintf(fp, "#if %s\n", +# if !_CALL_SYSV + "!" +# endif + "_CALL_SYSV" + ); +# endif +#endif + fprintf(fp, "#define JIT_INSTR_MAX %d\n", max); + for (offset = 0; offset < jit_code_last_code; offset++) + fprintf(fp, " %d, /* %s */\n", _szs[offset], code_name[offset]); +#if defined(__arm__) + fprintf(fp, "#endif /* __ARM_PCS_VFP */\n"); +#elif defined(__mips__) +# if __WORDSIZE == 32 + fprintf(fp, "#endif /* NEW_ABI */\n"); +# endif +#elif defined(__powerpc__) + fprintf(fp, "#endif /* " +# if !_CALL_SYSV + "!" +# endif + "_CALL_SYSV" + " */\n"); + fprintf(fp, "#endif /* __BYTE_ORDER */\n"); + fprintf(fp, "#endif /* __powerpc__ */\n"); +#endif +#if __X64 || __X32 +# if __X64 + fprintf(fp, "# endif /* __X64_32 */\n"); + fprintf(fp, "#endif /* __X64 */\n"); +# else + fprintf(fp, "#endif /* __X32 */\n"); +# endif +#else + fprintf(fp, "#endif /* __WORDSIZE */\n"); +#endif + + fclose(fp); + + return (0); +} -- cgit v1.2.3