forked from OSchip/llvm-project
Move ConstExpr production to unify ConstVal stuff
llvm-svn: 3351
This commit is contained in:
parent
61643a01c3
commit
7f1c98d060
|
@ -972,6 +972,26 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ConstVal : SIntType EINT64VAL { // integral constants
|
||||||
|
if (!ConstantSInt::isValueValidForType($1, $2))
|
||||||
|
ThrowException("Constant value doesn't fit in type!");
|
||||||
|
$$ = ConstantSInt::get($1, $2);
|
||||||
|
}
|
||||||
|
| UIntType EUINT64VAL { // integral constants
|
||||||
|
if (!ConstantUInt::isValueValidForType($1, $2))
|
||||||
|
ThrowException("Constant value doesn't fit in type!");
|
||||||
|
$$ = ConstantUInt::get($1, $2);
|
||||||
|
}
|
||||||
|
| BOOL TRUE { // Boolean constants
|
||||||
|
$$ = ConstantBool::True;
|
||||||
|
}
|
||||||
|
| BOOL FALSE { // Boolean constants
|
||||||
|
$$ = ConstantBool::False;
|
||||||
|
}
|
||||||
|
| FPType FPVAL { // Float & Double constants
|
||||||
|
$$ = ConstantFP::get($1, $2);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
ConstExpr: Types CAST ConstVal {
|
ConstExpr: Types CAST ConstVal {
|
||||||
$$ = ConstantExpr::getCast($3, $1->get());
|
$$ = ConstantExpr::getCast($3, $1->get());
|
||||||
|
@ -1019,26 +1039,6 @@ ConstExpr: Types CAST ConstVal {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ConstVal : SIntType EINT64VAL { // integral constants
|
|
||||||
if (!ConstantSInt::isValueValidForType($1, $2))
|
|
||||||
ThrowException("Constant value doesn't fit in type!");
|
|
||||||
$$ = ConstantSInt::get($1, $2);
|
|
||||||
}
|
|
||||||
| UIntType EUINT64VAL { // integral constants
|
|
||||||
if (!ConstantUInt::isValueValidForType($1, $2))
|
|
||||||
ThrowException("Constant value doesn't fit in type!");
|
|
||||||
$$ = ConstantUInt::get($1, $2);
|
|
||||||
}
|
|
||||||
| BOOL TRUE { // Boolean constants
|
|
||||||
$$ = ConstantBool::True;
|
|
||||||
}
|
|
||||||
| BOOL FALSE { // Boolean constants
|
|
||||||
$$ = ConstantBool::False;
|
|
||||||
}
|
|
||||||
| FPType FPVAL { // Float & Double constants
|
|
||||||
$$ = ConstantFP::get($1, $2);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ConstVector - A list of comma seperated constants.
|
// ConstVector - A list of comma seperated constants.
|
||||||
ConstVector : ConstVector ',' ConstVal {
|
ConstVector : ConstVector ',' ConstVal {
|
||||||
($$ = $1)->push_back($3);
|
($$ = $1)->push_back($3);
|
||||||
|
|
Loading…
Reference in New Issue