Hello! Is there an (semi)automatic way to save registers used by a function? For example, on my target I have to store ar0-ar4 and gr0-gr4, gr5, gr6. For now I just emit huge prologue code to push them all to stack -- even if they are not modified at all. Is there a way to tell LLVM which registers must be stored, and have it automatically issue pushes/pops? I can live with current design, just wondering. - Volodya
On Wed, 2004-06-09 at 04:56, Vladimir Prus wrote:> Hello! > Is there an (semi)automatic way to save registers used by a function? For > example, on my target I have to store ar0-ar4 and gr0-gr4, gr5, gr6. For now > I just emit huge prologue code to push them all to stack -- even if they are > not modified at all. > > Is there a way to tell LLVM which registers must be stored, and have it > automatically issue pushes/pops? I can live with current design, just > wondering.I assume you are talking about caller saved registers. If so, you can make the call instruction implicitly define these registers and the register allocator will handle the pushes/pops automatically. -- Alkis
Alkis Evlogimenos wrote:> On Wed, 2004-06-09 at 04:56, Vladimir Prus wrote: > > Hello! > > Is there an (semi)automatic way to save registers used by a function? For > > example, on my target I have to store ar0-ar4 and gr0-gr4, gr5, gr6. For > > now I just emit huge prologue code to push them all to stack -- even if > > they are not modified at all. > > > > Is there a way to tell LLVM which registers must be stored, and have it > > automatically issue pushes/pops? I can live with current design, just > > wondering. > > I assume you are talking about caller saved registers.Actually, about callee saved registers. The naive compiler pushes/pop all registers which are used in a function and must be preserved. - Volodya