Hi, Following up Richard's comments: https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00967.html
I investigate interrupt routines: * gcc can shrink-wrapping an interrupt routine (ARM mode). The shrink-wrap-interrupt_1.c in the patch can show it. * There is restriction for interrupt routine to be shrink-wrapped. e.g. shrink-wrap-interrupt_2.c can not be shrink-wrapped. * When interrupt routine is shrink-wrapped, it uses "*cond_simple_return" to return from the function. There is no dwarf info issue. So no need to change the codes. The patch only includes two test cases to track it. OK for trunk? Thanks! -Zhenqiang testsuite/ChangeLog: 2014-05-27 Zhenqiang Chen <zhenqiang.c...@linaro.org> * gcc.target/arm/shrink-wrap-interrupt_1.c: New test. * gcc.target/arm/shrink-wrap-interrupt_2.c: New test. diff --git a/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_1.c b/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_1.c new file mode 100644 index 0000000..3432115 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_1.c @@ -0,0 +1,24 @@ +/* Verify that shrink-wrapping works for functions + with __attribute__ ((interrupt)). */ + +/* { dg-do compile } */ +/* { dg-require-effective-target arm_nothumb } */ +/* { dg-options "-O2 -marm -mapcs -fdump-rtl-pro_and_epilogue" } */ + +/* This test is not valid when -mthumb. */ + +extern void test (int, int) __attribute__ ((interrupt ("IRQ"))); +int p; + +void +test (int a, int b) +{ + if (a > b) + { + p = a + 0x123456; + p = p * (b - 0x9879876); + } +} + +/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" } } */ +/* { dg-final { cleanup-rtl-dump "pro_and_epilogue" } } */ diff --git a/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_2.c b/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_2.c new file mode 100644 index 0000000..ecb793e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_2.c @@ -0,0 +1,24 @@ +/* Verify that shrink-wrapping works for functions + with __attribute__ ((interrupt)). */ + +/* { dg-do compile } */ +/* { dg-require-effective-target arm_nothumb } */ +/* { dg-options "-O2 -marm -mapcs -fdump-rtl-pro_and_epilogue" } */ + +/* This test is not valid when -mthumb. */ + +extern void test (int, int) __attribute__ ((interrupt ("IRQ"))); +int p; + +void +test (int a, int b) +{ + if (a) + { + p = a + 0x123456; + p = p * (b - 0x9879876); + } +} + +/* { dg-final { scan-rtl-dump-not "Performing shrink-wrapping" "pro_and_epilogue" } } */ +/* { dg-final { cleanup-rtl-dump "pro_and_epilogue" } } */