Draw STG F and D registers from the same pool of available SSE registers on x86-64.
[ghc.git] / includes / mkSizeMacros.cross.awk
1 BEGIN {
2 print "#define OFFSET(s_type, field) OFFSET_ ## s_type ## _ ## field"
3 print "#define FIELD_SIZE(s_type, field) FIELD_SIZE_ ## s_type ## _ ## field"
4 print "#define TYPE_SIZE(type) TYPE_SIZE_ ## type"
5 print ""
6 }
7
8 /^0[0-9a-zA-Z]* C _*associate\$/ {
9 sub(/_*associate\$/, "", $3)
10 split($3, arr, "$")
11 assoc[arr[2]] = arr[1]
12 next
13 }
14
15 /^00*2 C _*starting\$[0-9]*\$[_0-9a-zA-Z]*$/ {
16 sub(/_*starting\$/, "", $3)
17 split($3, arr, "$")
18 sub(/^0*/, "", $1)
19 print "#define OFFSET_" assoc[arr[1]] "_" arr[2] " 0x0"
20 next
21 }
22
23 /^0[0-9a-zA-Z]* C _*sizeof\$[0-9]*\$[_0-9a-zA-Z]*$/ {
24 sub(/_*sizeof\$/, "", $3)
25 split($3, arr, "$")
26 sub(/^0*/, "", $1)
27 print "#define OFFSET_" assoc[arr[1]] "_" arr[2] " 0x" $1
28 next
29 }
30
31 /^0[0-9a-zA-Z]* C _*fieldsize\$[0-9]*\$[_0-9a-zA-Z]*$/ {
32 sub(/_*fieldsize\$/, "", $3)
33 split($3, arr, "$")
34 sub(/^0*/, "", $1)
35 print "#define FIELD_SIZE_" assoc[arr[1]] "_" arr[2] " 0x" $1 "UL"
36 next
37 }
38
39 /^0[0-9a-zA-Z]* C _*nestedfieldsize\$[_0-9a-zA-Z]*\$[_0-9a-zA-Z]*$/ {
40 sub(/_*nestedfieldsize\$/, "", $3)
41 split($3, arr, "$")
42 sub(/^0*/, "", $1)
43 print "#define FIELD_SIZE_" arr[1] "_" arr[2] " 0x" $1 "UL"
44 next
45 }
46
47 /^0[0-9a-zA-Z]* C _*SIZEOF\$[0-9]*$/ {
48 sub(/_*SIZEOF\$/, "", $3)
49 sub(/^0*/, "", $1)
50 print "#define TYPE_SIZE_" assoc[$3] " 0x" $1
51 next
52 }
53
54 { print "// " $0 }
55
56 END {
57 ## some indirect offsets
58 print "#define OFFSET_StgHeader_prof_ccs (OFFSET_StgHeader_prof + OFFSET_StgProfHeader_ccs)"
59 print "#define OFFSET_StgHeader_prof_hp_ldvw (OFFSET_StgHeader_prof + OFFSET_StgProfHeader_hp + 0)"
60 print "#define OFFSET_StgTSO_prof_cccs (OFFSET_StgTSO_prof + OFFSET_StgTSOProfInfo_cccs)"
61 print "#define OFFSET_RTS_FLAGS_ProfFlags_showCCSOnException (OFFSET_RTS_FLAGS_ProfFlags + OFFSET_PROFILING_FLAGS_showCCSOnException)"
62
63
64 print "#define OFFSET_RTS_FLAGS_DebugFlags_apply (OFFSET_RTS_FLAGS_DebugFlags + OFFSET_DEBUG_FLAGS_apply)"
65 print "#define OFFSET_RTS_FLAGS_DebugFlags_sanity (OFFSET_RTS_FLAGS_DebugFlags + OFFSET_DEBUG_FLAGS_sanity)"
66 print "#define OFFSET_RTS_FLAGS_DebugFlags_weak (OFFSET_RTS_FLAGS_DebugFlags + OFFSET_DEBUG_FLAGS_weak)"
67 print "#define OFFSET_RTS_FLAGS_GcFlags_initialStkSize (OFFSET_RTS_FLAGS_GcFlags + OFFSET_GC_FLAGS_initialStkSize)"
68 print "#define OFFSET_RTS_FLAGS_MiscFlags_tickInterval (OFFSET_RTS_FLAGS_MiscFlags + OFFSET_MISC_FLAGS_tickInterval)"
69
70 print "#define OFFSET_StgFunInfoExtraFwd_b_bitmap (OFFSET_StgFunInfoExtraFwd_b + 0)"
71 print "#define OFFSET_StgFunInfoExtraRev_b_bitmap (OFFSET_StgFunInfoExtraRev_b + 0)"
72
73 ## some indirect field sizes
74 print "#define FIELD_SIZE_StgHeader_prof_ccs FIELD_SIZE_StgProfHeader_ccs"
75 print "#define FIELD_SIZE_StgTSO_prof_cccs FIELD_SIZE_StgTSOProfInfo_cccs"
76 print "#define FIELD_SIZE_RTS_FLAGS_ProfFlags_showCCSOnException FIELD_SIZE_PROFILING_FLAGS_showCCSOnException"
77 print "#define FIELD_SIZE_RTS_FLAGS_DebugFlags_apply FIELD_SIZE_DEBUG_FLAGS_apply"
78 print "#define FIELD_SIZE_RTS_FLAGS_DebugFlags_sanity FIELD_SIZE_DEBUG_FLAGS_sanity"
79 print "#define FIELD_SIZE_RTS_FLAGS_DebugFlags_weak FIELD_SIZE_DEBUG_FLAGS_weak"
80 print "#define FIELD_SIZE_RTS_FLAGS_GcFlags_initialStkSize FIELD_SIZE_GC_FLAGS_initialStkSize"
81 print "#define FIELD_SIZE_RTS_FLAGS_MiscFlags_tickInterval FIELD_SIZE_MISC_FLAGS_tickInterval"
82 }