mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
allow logical operators on packed integral types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24907 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1501,8 +1501,11 @@ ConstExpr: CAST '(' ConstVal TO Types ')' {
|
|||||||
| LogicalOps '(' ConstVal ',' ConstVal ')' {
|
| LogicalOps '(' ConstVal ',' ConstVal ')' {
|
||||||
if ($3->getType() != $5->getType())
|
if ($3->getType() != $5->getType())
|
||||||
ThrowException("Logical operator types must match!");
|
ThrowException("Logical operator types must match!");
|
||||||
if (!$3->getType()->isIntegral())
|
if (!$3->getType()->isIntegral()) {
|
||||||
ThrowException("Logical operands must have integral types!");
|
if (!isa<PackedType>($3->getType()) ||
|
||||||
|
!cast<PackedType>($3->getType())->getElementType()->isIntegral())
|
||||||
|
ThrowException("Logical operator requires integral operands!");
|
||||||
|
}
|
||||||
$$ = ConstantExpr::get($1, $3, $5);
|
$$ = ConstantExpr::get($1, $3, $5);
|
||||||
}
|
}
|
||||||
| SetCondOps '(' ConstVal ',' ConstVal ')' {
|
| SetCondOps '(' ConstVal ',' ConstVal ')' {
|
||||||
@@ -2079,8 +2082,11 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
|||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
| LogicalOps Types ValueRef ',' ValueRef {
|
| LogicalOps Types ValueRef ',' ValueRef {
|
||||||
if (!(*$2)->isIntegral())
|
if (!(*$2)->isIntegral()) {
|
||||||
ThrowException("Logical operator requires integral operands!");
|
if (!isa<PackedType>($2->get()) ||
|
||||||
|
!cast<PackedType>($2->get())->getElementType()->isIntegral())
|
||||||
|
ThrowException("Logical operator requires integral operands!");
|
||||||
|
}
|
||||||
$$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5));
|
$$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5));
|
||||||
if ($$ == 0)
|
if ($$ == 0)
|
||||||
ThrowException("binary operator returned null!");
|
ThrowException("binary operator returned null!");
|
||||||
|
Reference in New Issue
Block a user