Type demotion of induction variable for address calculation

shrey <shreyas76@gmail.com>
Wed, 23 Jun 2010 21:17:44 -0700 (PDT)

          From comp.compilers

Related articles
Type demotion of induction variable for address calculation shreyas76@gmail.com (shrey) (2010-06-23)
| List of all articles for this month |
From: shrey <shreyas76@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 23 Jun 2010 21:17:44 -0700 (PDT)
Organization: Compilers Central
Keywords: analysis, optimize, question
Posted-Date: 25 Jun 2010 16:25:39 EDT

Hi all
      I wish to explore the scenarios when the type of an induction
variable used say to index A[i[ in a loop can be demoted to a short.
The motivation being it would aid in an efficient code using 16 bit
multiplies instead of needing 32 bit multiplies for the target.




So far I can see the following cases
1. Size of A is less than 2^32 and assuming the source does not do out
of array access. Does c99 provide such guarrantees ?


2. the maximum value of i is less that 2^16/ sizeof(A[i])
Size of A[i] is size of element.


Is my reasoning valid ? And are there other scenarios ?


Also can some one point to me any such existing work ?


thanks
shrey



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.