Commit dd659286 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix more LLVM backend support

parent 2c220656
......@@ -964,6 +964,16 @@ def _expr_append_reference(expr, ctx):
apnd.apnd_list.extend(inner_right.apnd_list)
else:
apnd.apnd_list.append(expr.right)
# flat_list = []
# for each in apnd.apnd_list:
# # Also flatten Sequence Of primaries
# if isinstance(each, ogAST.PrimSequenceOf):
# flat_list.extend(each.value)
# else:
# flat_list.append(each)
# print '(1):', apnd.apnd_list
# apnd.apnd_list = flat_list
# print '(2):', apnd.apnd_list
apnd.exprType = expr.exprType
return apnd
......@@ -1994,8 +2004,13 @@ def sdl_assign(a_ptr, b_val, ctx):
each_arr_ptr = ctx.string_ptr(each_ptr.string)
each_count_val = lc.Constant.int(ctx.i32, int(each_ptr.length))
elif isinstance(each_ptr, SDLSequenceOf):
if not each_ptr.typeof:
each_ptr.typeof = b_val.exprType
each_arr_ptr = sdl_sequenceof(each_ptr, ctx)
each_count_val = lc.Constant.int(ctx.i32, each_ptr.length)
if bty.Min != bty.Max:
each_arr_ptr = ctx.builder.gep(each_arr_ptr,
[ctx.zero, ctx.one])
else:
each_bty = ctx.basic_asn1type_of(each.exprType)
if each_bty.Min != each_bty.Max:
......@@ -2005,15 +2020,11 @@ def sdl_assign(a_ptr, b_val, ctx):
each_arr_ptr = ctx.builder.gep(each_ptr,
[ctx.zero, ctx.one])
each_count_val = ctx.builder.load(each_len_ptr)
# total_size = total_size.add(
# ctx.builder.zext(each_count_val, ctx.i64))
else:
# Fixed size
each_arr_ptr = each_ptr
each_count_val = lc.Constant.int(ctx.i32,
int(each_bty.Min))
# total_size = total_size.add(
# ctx.builder.zext(each_count_val, ctx.i64))
total_size = ctx.builder.add(total_size, each_count_val)
sdl_call('memcpy', [
ctx.builder.bitcast(res_arr_ptr, ctx.i8_ptr),
......
/* CIF PROCESS (295, 56), (150, 75) */
/* CIF PROCESS (295, 57), (150, 75) */
PROCESS orchestrator
/* CIF COMMENT (405, 192), (71, 35) */
/* CIF COMMENT (405, 193), (71, 35) */
COMMENT 'Hello';
/* CIF TEXT (39, 94), (293, 263) */
dcl fixed FixedString := 'Helo';
dcl variable variableString := 'Hop';
dcl seqof seqbool;
/* CIF ENDTEXT */
/* CIF START (456, 110), (70, 35) */
START;
/* CIF TASK (456, 160), (70, 35) */
TASK 'tmp'
/* CIF COMMENT (546, 143), (253, 68) */
COMMENT 'writeln(fixed(0,2)//fixed(2,3)// word)
FIXME: string world
cannot be longer than
6 chars ! ';
/* CIF PROCEDURECALL (357, 210), (267, 35) */
/* CIF TASK (400, 160), (180, 35) */
TASK seqof := {true} // {false};
/* CIF TASK (409, 210), (163, 53) */
TASK for each in seqof:
call writeln(each);
endfor;
/* CIF PROCEDURECALL (368, 278), (244, 35) */
CALL writeln('(1) -> ', seqof(0), seqof(1));
/* CIF TASK (388, 328), (205, 33) */
TASK seqof := {true, false, false};
/* CIF PROCEDURECALL (368, 376), (244, 35) */
CALL writeln('(2) -> ', seqof(0), seqof(1));
/* CIF TASK (409, 426), (163, 53) */
TASK 'for each in seqof:
call writeln(each);
endfor';
/* CIF PROCEDURECALL (357, 494), (267, 35) */
CALL writeln(fixed(0,2)//fixed(2,3)// ' word');
/* CIF PROCEDURECALL (410, 260), (162, 35) */
/* CIF PROCEDURECALL (410, 544), (162, 35) */
CALL writeln(variable);
/* CIF TASK (397, 310), (188, 35) */
/* CIF TASK (397, 594), (188, 35) */
TASK variable := variable // '!!';
/* CIF PROCEDURECALL (410, 360), (162, 35) */
/* CIF PROCEDURECALL (410, 644), (162, 35) */
CALL writeln(variable);
/* CIF PROCEDURECALL (406, 410), (170, 35) */
/* CIF PROCEDURECALL (406, 694), (170, 35) */
CALL writeln(variable//':-)');
/* CIF NEXTSTATE (456, 460), (70, 35) */
/* CIF NEXTSTATE (456, 744), (70, 35) */
NEXTSTATE wait;
/* CIF STATE (272, 359), (70, 35) */
STATE wait;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment