Induction Variable - Application To Reduce Register Pressure

Application To Reduce Register Pressure

In some cases, it is possible to reverse this optimization in order to remove an induction variable from the code entirely. For example:

extern int sum; int foo(int n) { int i, j; j = 5; for (i=0; i < n; ++i) { j += 2; sum += j; } return sum; }

This function's loop has two induction variables: i and j. Either one can be rewritten as a linear function of the other; therefore, the compiler may optimize this code as if it had been written

extern int sum; int foo(int n) { int i; for (i=0; i < n; ++i) { sum += (5 + 2*(i+1)); } return sum; }

Read more about this topic:  Induction Variable

Famous quotes containing the words application to, application, reduce, register and/or pressure:

    “Five o’clock tea” is a phrase our “rude forefathers,” even of the last generation, would scarcely have understood, so completely is it a thing of to-day; and yet, so rapid is the March of the Mind, it has already risen into a national institution, and rivals, in its universal application to all ranks and ages, and as a specific for “all the ills that flesh is heir to,” the glorious Magna Charta.
    Lewis Carroll [Charles Lutwidge Dodgson] (1832–1898)

    There are very few things impossible in themselves; and we do not want means to conquer difficulties so much as application and resolution in the use of means.
    François, Duc De La Rochefoucauld (1613–1680)

    The business of the law is to make sense of the confusion of what we call human life—to reduce it to order but at the same time to give it possibility, scope, even dignity.
    Archibald MacLeish (1892–1982)

    In 1872 I received a request like this and I did register and vote, for which I was arrested, convicted and fined $100. Excuse me if I decline to repeat the experience.
    Susan B. Anthony (1820–1906)

    The mother whose self-image is dependent on her children places on those children the responsibility for her own identity, and her involvement in the details of their lives can put great pressure on the children. A child suffers when everything he or she does is extremely important to a parent; this kind of over-involvement can turn even a small problem into a crisis.
    Grace Baruch (20th century)