[PATCH 2/5] objtool: More consistent use of arch_callee_saved_reg()

From: Peter Zijlstra
Date: Wed Feb 03 2021 - 07:05:39 EST


Since save_regs() will only ever set a reg when it is
arch_callee_saved_reg() all the other regs will always be unused and
are effectively scratch space.

No point in comparing them.

Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
tools/objtool/check.c | 6 ++++++
1 file changed, 6 insertions(+)

--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1725,6 +1725,9 @@ static bool has_modified_stack_frame(str
return false;

for (i = 0; i < CFI_NUM_REGS; i++) {
+ if (!arch_callee_saved_reg(i))
+ continue;
+
if (cfi->regs[i].base != initial_func_cfi.regs[i].base ||
cfi->regs[i].offset != initial_func_cfi.regs[i].offset)
return true;
@@ -2248,6 +2251,9 @@ static bool insn_cfi_match(struct instru

} else if (memcmp(&cfi1->regs, &cfi2->regs, sizeof(cfi1->regs))) {
for (i = 0; i < CFI_NUM_REGS; i++) {
+ if (!arch_callee_saved_reg(i))
+ continue;
+
if (!memcmp(&cfi1->regs[i], &cfi2->regs[i],
sizeof(struct cfi_reg)))
continue;