backend: add global immediate optimization

Graphics / Beignet - rander [] - 23 June 2017 04:04 EDT

there are some global immediates in global var list of LLVM. these imm can be integrated in instructions. for compiler_global_immediate_optimized test in utest, there are two global immediates: L0: MOV(1) %42<0>:UD : 0x0:UD MOV(1) %43<0>:UD : 0x30:UD

used by: ADD(16) %49<1>:D : %42<0,1,0>:D %48<8,8,1>:D ADD(16) %54<1>:D : %43<0,1,0>:D %53<8,8,1>:D

it can be ADD(16) %49<1>:D : %48<8,8,1>:D 0x0:UD ADD(16) %54<1>:D : %53<8,8,1>:D 0x30:UD

Then the MOV can be removed. And after this optimization, ADD 0 can be change to MOV, then local copy propagation can be done.

V2: (1) add environment variable to enable/disable the optimization (2) refine the architecture of imm optimization, inherit from global optimizer not local block optimizer

V3: merge with latest master driver

V4: (1)refine some type errors (2)remove UD/D check for no need (3)refine imm calculate for UD/D

8d3e93f backend: add global immediate optimization
.../src/backend/gen_insn_selection_optimize.cpp | 367 +++++++++++++++++++--
1 file changed, 342 insertions(+), 25 deletions(-)


  • Share