Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
21de5425
Commit
21de5425
authored
Nov 02, 2014
by
Maxime Perrotin
Browse files
Fix LLVM backend
parent
dd659286
Changes
2
Hide whitespace changes
Inline
Side-by-side
LlvmGenerator.py
View file @
21de5425
...
...
@@ -964,16 +964,7 @@ 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
...
...
@@ -1114,7 +1105,7 @@ def _expr_neg(expr, ctx):
def
_expr_assign
(
expr
,
ctx
):
''' Generate the IR for an assign expression '''
right
=
expression
(
expr
.
right
,
ctx
)
if
isinstance
(
right
,
(
SDLStringLiteral
,
SDLSequenceOf
)):
if
isinstance
(
right
,
(
SDLStringLiteral
,
SDLSequenceOf
,
SDLAppendValue
)):
# Assigning string literal - make sure the left type is known
right
.
typeof
=
expr
.
left
.
exprType
sdl_assign
(
reference
(
expr
.
left
,
ctx
),
right
,
ctx
)
...
...
@@ -1976,8 +1967,10 @@ def sdl_assign(a_ptr, b_val, ctx):
ctx
.
builder
.
store
(
b_val
.
count_val
,
a_count_ptr
)
elif
isinstance
(
b_val
,
SDLAppendValue
):
bty
=
ctx
.
basic_asn1type_of
(
b_val
.
exprType
)
res_llty
=
ctx
.
lltype_of
(
b_val
.
exprType
)
#bty = ctx.basic_asn1type_of(b_val.exprType)
#res_llty = ctx.lltype_of(b_val.exprType)
bty
=
ctx
.
basic_asn1type_of
(
b_val
.
typeof
)
res_llty
=
ctx
.
lltype_of
(
b_val
.
typeof
)
res_ptr
=
a_ptr
total_size
=
lc
.
Constant
.
int
(
ctx
.
i32
,
0
)
# Get pointer to data and nCount (if any) fields
...
...
@@ -2005,7 +1998,7 @@ def sdl_assign(a_ptr, b_val, ctx):
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_ptr
.
typeof
=
b_val
.
typeof
#
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
:
...
...
tests/regression/test-llvm/orchestrator.pr
View file @
21de5425
...
...
@@ -11,8 +11,8 @@ dcl seqof seqbool;
/* CIF ENDTEXT */
/* CIF START (456, 110), (70, 35) */
START;
/* CIF TASK (
400
, 160), (
180
, 35) */
TASK seqof := {true} // {false};
/* CIF TASK (
372
, 160), (
235
, 35) */
TASK seqof := {true} //
{false} //
{false};
/* CIF TASK (409, 210), (163, 53) */
TASK for each in seqof:
call writeln(each);
...
...
@@ -20,9 +20,9 @@ endfor;
/* CIF PROCEDURECALL (368, 278), (244, 35) */
CALL writeln('(1) -> ', seqof(0), seqof(1));
/* CIF TASK (388, 328), (205, 33) */
TASK seqof :=
{true, false, fals
e};
TASK seqof :=
seqof // {tru
e};
/* CIF PROCEDURECALL (368, 376), (244, 35) */
CALL writeln('(2) -> ', seqof(0), seqof(
1
));
CALL writeln('(2) -> ', seqof(0), seqof(
3
));
/* CIF TASK (409, 426), (163, 53) */
TASK 'for each in seqof:
call writeln(each);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment