OSDN Git Service

Opt Compiler: Materialise constants that cannot be encoded
authorSerban Constantinescu <serban.constantinescu@arm.com>
Sun, 22 Feb 2015 22:08:01 +0000 (22:08 +0000)
committerSerban Constantinescu <serban.constantinescu@arm.com>
Wed, 11 Mar 2015 17:45:09 +0000 (17:45 +0000)
commit758c2f65805564e0c51cccaacf8307e52a9e312b
treeec8bbbe69fa3f263dd91763fe1bef81cf090f468
parent637455782147a41fbde2e284c49ca5e02d3444c2
Opt Compiler: Materialise constants that cannot be encoded

The VIXL MacroAssembler deals gracefully with any immediate. However
when the constant has multiple uses and cannot be encoded in the
instruction's immediate field we are better off using a register for
the constant and thus sharing the constant generation between multiple
uses.

Eg:
  var += #Const;    // #Const cannot be encoded.
  var += #Const;

Before:                 After:
  mov wip0, #Const        mov w4, #Const
  add w0, w0, wip0        add w0, w0, w4
  mov wip0, #Const        add w0, w0, w4
  add w0, w0, wip0

Change-Id: I8d1f620872d1241cf582fb4f3b45b5091b790146
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
compiler/optimizing/code_generator_arm64.cc
compiler/optimizing/common_arm64.h