[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Chris Lattner
lattner at cs.uiuc.edu
Thu May 5 22:52:01 PDT 2005
Changes in directory llvm/lib/AsmParser:
llvmAsmParser.y updated: 1.219 -> 1.220
---
Log message:
Add a 'tail' marker for call instructions, patch contributed by
Alexander Friedman.
---
Diffs of the changes: (+20 -4)
llvmAsmParser.y | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.219 llvm/lib/AsmParser/llvmAsmParser.y:1.220
--- llvm/lib/AsmParser/llvmAsmParser.y:1.219 Mon May 2 14:07:27 2005
+++ llvm/lib/AsmParser/llvmAsmParser.y Fri May 6 00:51:46 2005
@@ -803,6 +803,7 @@
%type <JumpTable> JumpTable
%type <BoolVal> GlobalType // GLOBAL or CONSTANT?
%type <BoolVal> OptVolatile // 'volatile' or not
+%type <BoolVal> OptTailCall // TAIL CALL or plain CALL.
%type <Linkage> OptLinkage
%type <Endianness> BigOrLittle
@@ -837,7 +838,7 @@
%token DECLARE GLOBAL CONSTANT VOLATILE
%token TO DOTDOTDOT NULL_TOK UNDEF CONST INTERNAL LINKONCE WEAK APPENDING
%token OPAQUE NOT EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG
-%token DEPLIBS
+%token DEPLIBS CALL TAIL
// Basic Block Terminating Operators
%token <TermOpVal> RET BR SWITCH INVOKE UNWIND UNREACHABLE
@@ -852,7 +853,8 @@
// Other Operators
%type <OtherOpVal> ShiftOps
-%token <OtherOpVal> PHI_TOK CALL CAST SELECT SHL SHR VAARG VANEXT
+%token <OtherOpVal> PHI_TOK CAST SELECT SHL SHR VAARG VANEXT
+
%start Module
%%
@@ -883,6 +885,9 @@
ShiftOps : SHL | SHR;
+
+
+
// These are some types that allow classification if we only want a particular
// thing... for example, only a signed, unsigned, or integral type.
SIntType : LONG | INT | SHORT | SBYTE;
@@ -1858,6 +1863,15 @@
// ValueRefListE - Just like ValueRefList, except that it may also be empty!
ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; };
+OptTailCall : TAIL CALL {
+ $$ = true;
+ }
+ | CALL {
+ $$ = false;
+ };
+
+
+
InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() &&
!isa<PackedType>((*$2).get()))
@@ -1944,8 +1958,8 @@
$2->pop_front();
}
delete $2; // Free the list...
- }
- | CALL TypesV ValueRef '(' ValueRefListE ')' {
+ }
+ | OptTailCall TypesV ValueRef '(' ValueRefListE ')' {
const PointerType *PFTy;
const FunctionType *Ty;
@@ -1997,6 +2011,7 @@
$$ = new CallInst(V, *$5);
}
+ cast<CallInst>($$)->setTailCall($1);
delete $2;
delete $5;
}
@@ -2020,6 +2035,7 @@
};
+
MemoryInst : MALLOC Types {
$$ = new MallocInst(*$2);
delete $2;
More information about the llvm-commits
mailing list