-Obfv: Optimize Bitfields and Volatile Bitfields

Group

OPTIMIZATIONS

Scope

Function

Syntax
  -Obfv
  
  
Arguments

None

Default

None

Defines

None

Pragmas

None

Description

Use this option to optimize bitfields and volatile bitfields. The compiler changes the access order or combines many accesses into one, even if the bitfields are declared as volatile.

Example

The following listing contains bitfields to be optimized with the -Obfv compiler option.

Listing: Bitfields Example


volatile struct {
  unsigned int b0:1;

  unsigned int b1:1;

  unsigned int b2:1;

} bf;

void myfun(void) {

  bf.b0 = 1;  bf.b1 = 1;  bf.b2 = 1;

}

Using the -Obfv option, bitfield access looks like:

  BSET  bf,#7
  
  

Without using the -Obfv option, bitfield access looks like:

  BSET  bf,#1
  
  
  BSET  bf,#2
  
  
  BSET  bf,#4