Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
13d33a4a
Commit
13d33a4a
authored
Jun 05, 2014
by
dbarbera
Browse files
Added logic expressions generation
parent
4a1b820e
Changes
1
Hide whitespace changes
Inline
Side-by-side
LlvmGenerator.py
View file @
13d33a4a
...
...
@@ -299,7 +299,29 @@ def _assign(expr):
@
expression
.
register
(
ogAST
.
ExprXor
)
def
_bitwise_operators
(
expr
):
''' Logical operators '''
raise
NotImplementedError
builder
=
LLVM
[
'builder'
]
func
=
builder
.
basic_block
.
function
lefttmp
=
expression
(
expr
.
left
)
righttmp
=
expression
(
expr
.
right
)
ty
=
find_basic_type
(
expr
.
exprType
)
if
ty
.
kind
!=
'BooleanType'
:
raise
NotImplementedError
# load the value of the expression if it is a pointer
if
lefttmp
.
type
.
kind
==
core
.
TYPE_POINTER
:
lefttmp
=
builder
.
load
(
lefttmp
,
'lefttmp'
)
if
righttmp
.
type
.
kind
==
core
.
TYPE_POINTER
:
righttmp
=
builder
.
load
(
righttmp
,
'lefttmp'
)
if
expr
.
operand
==
'&&'
:
return
builder
.
and_
(
lefttmp
,
righttmp
,
'ortmp'
)
elif
expr
.
operand
==
'||'
:
return
builder
.
or_
(
lefttmp
,
righttmp
,
'ortmp'
)
else
:
return
builder
.
xor
(
lefttmp
,
righttmp
,
'xortmp'
)
@
expression
.
register
(
ogAST
.
ExprAppend
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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