<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div> Ideally there would be one target-independent IR for, for example: </div><div><br></div><div><br></div><div><br></div><div> VAR a := BYTESIZE(INTEGER);  </div><div> VAR b := BITSIZE(INTEGER) = 64;  </div><div> TYPE T1 = RECORD a,b:INTEGER END;  </div><div> CONST pt1: REF T1 = NIL;  </div><div> VAR offset_of_b := LOOPHOLE(INTEGER, ADR(pt1.b));  </div><div><br></div><div><br></div><div><br></div><div> so that it could be translated to target-independent C something like: </div><div><br></div><div><br></div><div> #if ...almost always true...  </div><div> typedef ptrdiff_t INTEGER; </div><div> #else </div><div> ... </div><div> #endif  </div><div> INTEGER a = sizeof(INTEGER); </div><div> typedef unsigned char BOOLEAN;  </div><div> BOOLEAN b = (sizeof(INTEGER) * 8) == 64;  </div><div> typedef struct { a,b:INTEGER; } T1; </div><div> T1* pt1; </div><div> // ideal but unlikely: </div><div> INTEGER offset_of_b = offsetof(T1, b); </div><div> // more likely:  </div><div> INTEGER offset_of_b; </div><div> void module_initializer() </div><div> { </div><div>   offset_of_b = (INTEGER)&pt1->b; </div><div> } </div><div><br></div><div>  </div><div><br></div><div>Is this feasible?</div><div><br></div><div><br></div><div><br></div><div> Can instances of "INTEGER" somehow be left higher level for resolution </div><div> by the backend? Or can they be left "dual", both "resolved" and "symbolic"? </div><div> Or would this require too much change?</div><div><br></div><div> </div><div><br></div><div> I would be very reluctantly satisfied if the frontend ran </div><div> a certain portion of itself twice, once for each word size, indicating </div><div> the start/end of the passes to the backend, so the generated C would </div><div> be doubled up with an #if something like: </div><div><br></div><div><br></div><div>#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) ...</div><div><br></div><div> ... everything ... </div><div><br></div><div> #else // 32 bit </div><div><br></div><div> ... everything ... </div><div><br></div><div> #endif</div><div><br></div><div><br></div><div>The agenda is target-independent C output from the C backend,</div><div>as a portable redistributable form.</div><div>This is approximately one of the three problems to solve to achieve that.</div><div><br></div><div><br></div><div><br></div><div>Thanks,</div><div> - Jay</div><br>                                           </div></body>
</html>