[llvm-dev] Lowering For Loops to use architecture "loop" instruction

Joerg Sonnenberger via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 2 10:14:44 PDT 2016

On Thu, Jun 02, 2016 at 03:18:08AM +0000, Dilan Manatunga via llvm-dev wrote:
> I'm working on project which involves writing a backend for a hypothetical
> architecture. I am currently trying to figure out the best way to translate
> for loops to use a specialized "loop" instruction the architecture
> supports. The instruction is similar X86's loop instruction, where a
> register is automatically decremented and the condition is automatically
> checked to see if loop execution should continue.
> I was wondering what is the best way to go about implementing this. I tried
> looking to see how X86 implemented their loop instruction, but couldn't
> really find where the IR instructions were being lowered to the loop
> instruction.

A better example might PowerPC's CTR loop pass.


More information about the llvm-dev mailing list