Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers LCC > Strategy to imp...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 1012 of 1062
Post > Topic >>

Strategy to implement 64-bit contants for lcc

by kostas@[EMAIL PROTECTED] Jan 4, 2008 at 11:20 AM

I am in the process of retargetting lcc 4.2 for a 32-bit architecture.
However I want it to sup****t 64bit arithmetic. Implementing sup****t
for the 64bit terminal patterns  (e.g. ADDI8, ASGNI8, etc) in the
backend was not that difficult. I was able to generate code that
sup****ts 64bit arithmetic.

When I was about to create test cases for the 64bit arithmetic I
wanted to use long long constants (e.g. 12345678987654321LL). In order
to do that I modified the value union in c.h and added:

	long long ill;
	unsigned long long ull;

members to be able to store 64bit contants. I was succesful in reading
contants by appropriately modify the icon() function in lex.c and
using their value in my backend md file. Tweeking files sym.c, types.c
and stab.c where needed to utilize the new 64 contants was not
difficult either.

The problem is the simplification functions (e.g. simplify) in simp.c
that perform contant folding, casting etc. The amount of changes seem
to be overwhelming.

In all my changes I am handing 64bit contants conditionally by the
size of the type. In lcc 4.2 all integer contants are of type INT or
UNSIGNED. There is a discepancy in the way integer types are defined
in the lcc book by Fraser & Hanson and the way that they are actually
implemented in lcc 4.2. According to the book the basic integer types
have distinct operands (type->op) according to their sizes (e.g. CHAR,
SHORT, INT, UNSIGNED) while in the lcc4.2 implementation (types.c)
they are either INT or UNSIGNED. I was debating of whether I should
introduce a LONGLONG or a LONG+LONG type and handle the long long
constants using case statements on the type->op instead of conditional
statements on the type->size.

Given that lcc-win32 sup****ts long long constants I am sure these
concerns have been addressed before. I would like to get some thoughs
and feedback on how I should go about implementing long long
constants. If there is source code available out there I would be glad
to obtain it.
 




 4 Posts in Topic:
Strategy to implement 64-bit contants for lcc
kostas@[EMAIL PROTECTED]   2008-01-04 11:20:03 
Re: Strategy to implement 64-bit contants for lcc
jacob navia <jacob@[EM  2008-01-04 22:27:13 
Re: Strategy to implement 64-bit contants for lcc
kostas@[EMAIL PROTECTED]   2008-01-04 15:26:47 
Re: Strategy to implement 64-bit contants for lcc
jacob navia <jacob@[EM  2008-01-06 13:09:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 2:56:44 CDT 2008.