summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-08-15 18:17:28 +0000
committerChris Lattner <sabre@nondot.org>2002-08-15 18:17:28 +0000
commitd05e359b102b508376fb34ea5733a97e5bc885dd (patch)
tree48c7aa03ca50b2dcc969f29cd19dd084d76a02a7 /lib
parent3101c25293447cf939759ec2bd9a6a003eb284ad (diff)
downloadexternal_llvm-d05e359b102b508376fb34ea5733a97e5bc885dd.zip
external_llvm-d05e359b102b508376fb34ea5733a97e5bc885dd.tar.gz
external_llvm-d05e359b102b508376fb34ea5733a97e5bc885dd.tar.bz2
Move ConstExpr production to unify ConstVal stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AsmParser/llvmAsmParser.y40
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 0175d65..5eed0eb 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -972,6 +972,26 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
$$ = $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 {
$$ = 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 : ConstVector ',' ConstVal {
($$ = $1)->push_back($3);