GBE: add legalize pass to handle wide integers
authorRuiling Song <ruiling.song@intel.com>
Sat, 11 Oct 2014 06:09:37 +0000 (14:09 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Sat, 11 Oct 2014 08:39:59 +0000 (16:39 +0800)
commit270ac05a4744402fd6d5a4bb3c1504c481b0a8cf
treed5c2d616769e8600c5f1f81611d9538c2d2c5b59
parent4be08295fef96b2d75f97fa8a398697e312d698b
GBE: add legalize pass to handle wide integers

This legalize pass will break wider integers like i128/i256/... into shorter ones.
The problem is how to choose the shorter type? From my observation,
wide integer type always comes from shorter ones through 'zext' on small type
or 'bitcast' on vectors, so we simply choose the type where it comes from.
Then we can split wide integer operations into operations on shorter interger.

v2:
  add an assert on the wide integer bit-width, should be power of 2.
  use rpo_iterator to make sure traverse Value def before its use.

v3:
  drop all references before erase processed instruction.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
backend/src/CMakeLists.txt
backend/src/llvm/llvm_gen_backend.hpp
backend/src/llvm/llvm_legalize.cpp [new file with mode: 0644]
backend/src/llvm/llvm_to_gen.cpp