size.c - lightning.git - Portable just-in-time compiler library

index : lightning.git
Portable just-in-time compiler library
summary refs log tree commit diff
path: root/size.c
blob: 437559f05f9b0d0cc0f91c79720b80865e4f86b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * Copyright (C) 2013 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 <lightning.h>
#include <lightning/jit_private.h>
#include <stdio.h>
jit_int16_t	_szs[jit_code_last_code + 1];
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);
 fprintf(fp, "#if __WORDSIZE == %d\n", __WORDSIZE);
#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(__ppc__)
 fprintf(fp, "#if defined(__ppc__)\n");
#elif defined(__powerpc__)
 fprintf(fp, "#if defined(__powerpc__)\n");
#endif
 fprintf(fp, "#define JIT_INSTR_MAX %d\n", max);
 for (offset = 0; offset <= jit_code_last_code; offset++)
	fprintf(fp, " %d,\n", _szs[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(__ppc__)
 fprintf(fp, "#endif /* __ppc__ */\n");
#elif defined(__powerpc__)
 fprintf(fp, "#endif /* __powerpc__ */\n");
#endif
 fprintf(fp, "#endif /* __WORDSIZE */\n");
 fclose(fp);
 return (0);
}
generated by cgit v1.2.3 (git 2.46.0) at 2025年10月01日 16:48:18 +0000

AltStyle によって変換されたページ (->オリジナル) /