【问题标题】:How to switch the optimization level of the compiler partially for every function?如何为每个函数部分切换编译器的优化级别?
【发布时间】:2018-07-13 06:36:43
【问题描述】:

如何将编译器 (xc16) 的优化级别切换到每个函数的不同级别?

例如:

void _ISR _T1Interrupt    //compile with O0
{
.....
}

int_16_t main (void)         //compile with O2
{
.....
}

【问题讨论】:

    标签: optimization compiler-optimization xc16


    【解决方案1】:

    我找到了解决办法:

    __attribute__((optimize("-O0"))   //optimization for the next function is O0
    void _ISR _T1Interrupt            //compile with O0
    {
    .....
    }
    
    __attribute__((optimize("-O2"))   //optimization for the next function is O2
    int_16_t main (void)              //compile with O2
    {
    .....
    }
    

    【讨论】:

      猜你喜欢
      • 2011-10-13
      • 1970-01-01
      • 2022-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多