projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
21687e8
)
factor optional alignment
author
Chris Lattner
<sabre@nondot.org>
Sun, 6 Nov 2005 06:34:12 +0000
(06:34 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Sun, 6 Nov 2005 06:34:12 +0000
(06:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24207
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/AsmParser/llvmAsmParser.y
patch
|
blob
|
history
diff --git
a/lib/AsmParser/llvmAsmParser.y
b/lib/AsmParser/llvmAsmParser.y
index 6bfc3bb8e83f2d02afbbe44841dc14655c0faff4..678e62746e2c44da16ec868f1c93f371a845e498 100644
(file)
--- a/
lib/AsmParser/llvmAsmParser.y
+++ b/
lib/AsmParser/llvmAsmParser.y
@@
-948,7
+948,7
@@
Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
%token <StrVal> VAR_ID LABELSTR STRINGCONSTANT
%type <StrVal> Name OptName OptAssign
%token <StrVal> VAR_ID LABELSTR STRINGCONSTANT
%type <StrVal> Name OptName OptAssign
-
+%type <UIntVal> OptCAlign
%token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK
%token DECLARE GLOBAL CONSTANT VOLATILE
%token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK
%token DECLARE GLOBAL CONSTANT VOLATILE
@@
-1035,6
+1035,11
@@
OptCallingConv : /*empty*/ { $$ = CallingConv::C; } |
$$ = $2;
};
$$ = $2;
};
+// OptAlign/OptCAlign - An optional alignment, and an optional alignment with
+// a comma before it.
+OptCAlign : /*empty*/ { $$ = 0; } |
+ ',' ALIGN EUINT64VAL { $$ = $3; };
+
//===----------------------------------------------------------------------===//
// Types includes all predefined types... except void, because it can only be
// used in specific contexts (function returning void for example). To have
//===----------------------------------------------------------------------===//
// Types includes all predefined types... except void, because it can only be
// used in specific contexts (function returning void for example). To have
@@
-2204,48
+2209,32
@@
OptVolatile : VOLATILE {
-MemoryInst : MALLOC Types {
- $$ = new MallocInst(*$2);
+MemoryInst : MALLOC Types OptCAlign {
+ if ($3 & ($3-1))
+ ThrowException("Alignment amount '" + utostr($3) +
+ "' is not a power of 2!");
+ $$ = new MallocInst(*$2, 0, $3);
delete $2;
}
delete $2;
}
- | MALLOC Types ','
ALIGN EUINT64VAL
{
- if ($
5 & ($5
-1))
- ThrowException("Alignment amount '" + utostr($
5
) +
+ | MALLOC Types ','
UINT ValueRef OptCAlign
{
+ if ($
6 & ($6
-1))
+ ThrowException("Alignment amount '" + utostr($
6
) +
"' is not a power of 2!");
"' is not a power of 2!");
- $$ = new MallocInst(*$2, 0, $5);
- delete $2;
- }
- | MALLOC Types ',' UINT ValueRef {
- $$ = new MallocInst(*$2, getVal($4, $5));
+ $$ = new MallocInst(*$2, getVal($4, $5), $6);
delete $2;
}
delete $2;
}
- |
MALLOC Types ',' UINT ValueRef ',' ALIGN EUINT64VAL
{
- if ($
8 & ($8
-1))
- ThrowException("Alignment amount '" + utostr($
8
) +
+ |
ALLOCA Types OptCAlign
{
+ if ($
3 & ($3
-1))
+ ThrowException("Alignment amount '" + utostr($
3
) +
"' is not a power of 2!");
"' is not a power of 2!");
- $$ = new MallocInst(*$2, getVal($4, $5), $8);
- delete $2;
- }
- | ALLOCA Types {
- $$ = new AllocaInst(*$2);
- delete $2;
- }
- | ALLOCA Types ',' ALIGN EUINT64VAL {
- if ($5 & ($5-1))
- ThrowException("Alignment amount '" + utostr($5) +
- "' is not a power of 2!");
- $$ = new AllocaInst(*$2, 0, $5);
- delete $2;
- }
- | ALLOCA Types ',' UINT ValueRef {
- $$ = new AllocaInst(*$2, getVal($4, $5));
+ $$ = new AllocaInst(*$2, 0, $3);
delete $2;
}
delete $2;
}
- | ALLOCA Types ',' UINT ValueRef
',' ALIGN EUINT64VAL
{
- if ($
8 & ($8
-1))
- ThrowException("Alignment amount '" + utostr($
8
) +
+ | ALLOCA Types ',' UINT ValueRef
OptCAlign
{
+ if ($
6 & ($6
-1))
+ ThrowException("Alignment amount '" + utostr($
6
) +
"' is not a power of 2!");
"' is not a power of 2!");
- $$ = new AllocaInst(*$2, getVal($4, $5), $
8
);
+ $$ = new AllocaInst(*$2, getVal($4, $5), $
6
);
delete $2;
}
| FREE ResolvedVal {
delete $2;
}
| FREE ResolvedVal {