When to use earlyclobber constraint in extended GCC inline assembly?

前端 未结 2 1794
误落风尘
误落风尘 2020-11-28 13:48

I understand when to use a cobbler list (e.g. listing a register which is modified in the assembly so that it doesn\'t get chosen for use as an input register, etc), but I c

2条回答
  •  攒了一身酷
    2020-11-28 14:25

    By default, the compiler assumes all inputs will be consumed before any output registers are written to, so that it's allowed to use the same registers for both. This leads to better code when possible, but if the assumption is wrong, things will fail catastrophically. The "early clobber" marker is a way to tell the compiler that this output will be written before all the input has been consumed, so it cannot share a register with any input.

提交回复
热议问题