This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why does the assembly code sometimes store the register values into RAM and sometimes not?

I have two pieces of code that are very similar. Both of the code are compiled with the `-O0` flag in AC5. When I look at the assembly of the first code, I found that some variables loaded into registers would not be stored into RAM back. As show in the figure below for pOut2, pBias, pB, pB2, and pA2.

But in the assembly of the other code, all variables loaded into registers would be stored in RAM. As show in the figure below.

I don't want the assembly code store the register values into RAM, because the `STR` instruction accupies clock cycle. I want the compiler to maximize the use of registers. How can I achieve this?

Parents
  • I don't want the assembly code store the register values into RAM, because the `STR` instruction accupies clock cycle

    If your application is really so critical that details like this matter, then you should be writing it in assembler in the first place.

    I want the compiler to maximize the use of registers

    The compiler will do that anyway - but it may have a different view of "maximise" than you.

    Again, if this level of detail really matters to you, then you should be writing it in assembler in the first place.

Reply
  • I don't want the assembly code store the register values into RAM, because the `STR` instruction accupies clock cycle

    If your application is really so critical that details like this matter, then you should be writing it in assembler in the first place.

    I want the compiler to maximize the use of registers

    The compiler will do that anyway - but it may have a different view of "maximise" than you.

    Again, if this level of detail really matters to you, then you should be writing it in assembler in the first place.

Children