GBE: fixed the stack allocation.
authorZhigang Gong <zhigang.gong@intel.com>
Fri, 17 Jan 2014 02:42:25 +0000 (10:42 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Fri, 17 Jan 2014 06:27:49 +0000 (14:27 +0800)
commit00c4622ff94b44091a91842a5b51376aed9e23c2
treebe4da06da58d2f52cc6c139348e2a7d2d010db81
parent142a45e602c612d0c7c73806c8038da7c56b9ac0
GBE: fixed the stack allocation.

Yongjia wrote a case hit the previous 1KB limitation. I took a look at
the stack pointer related code then I found the implementation is not
comply with the OCL spec.

According to OpenCL spec, section 6.9:

d. Variable length arrays and structures with flexible (or unsized) arrays are not supported.

Thus all the local variable size should be constant, and we can
manipulate the stack pointer easier , no need to do the alignment
calculating at runtime, and could get the eaxct stack size then
allocate stack size on demand. I still put a limitation there which
is 64KB.

v2:
don't add the step if the step is zero.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
backend/src/backend/context.cpp
backend/src/ir/function.cpp
backend/src/ir/function.hpp
backend/src/llvm/llvm_gen_backend.cpp