Parse undef and unreachable


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17053 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 70aee05..f450c8f 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -298,6 +298,9 @@
       ThrowException("Cannot create a a non pointer null!");
     return ConstantPointerNull::get(cast<PointerType>(Ty));
     
+  case ValID::ConstUndefVal:      // Is it an undef value?
+    return UndefValue::get(Ty);
+    
   case ValID::ConstantVal:       // Fully resolved constant?
     if (D.ConstantValue->getType() != Ty)
       ThrowException("Constant expression type different from required type!");
@@ -908,12 +911,12 @@
 
 %token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK
 %token DECLARE GLOBAL CONSTANT VOLATILE
-%token TO DOTDOTDOT NULL_TOK CONST INTERNAL LINKONCE WEAK  APPENDING
+%token TO DOTDOTDOT NULL_TOK UNDEF CONST INTERNAL LINKONCE WEAK  APPENDING
 %token OPAQUE NOT EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG
 %token DEPLIBS 
 
 // Basic Block Terminating Operators 
-%token <TermOpVal> RET BR SWITCH INVOKE UNWIND
+%token <TermOpVal> RET BR SWITCH INVOKE UNWIND UNREACHABLE
 
 // Binary Operators 
 %type  <BinaryOpVal> ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories
@@ -1221,6 +1224,10 @@
     $$ = ConstantPointerNull::get(PTy);
     delete $1;
   }
+  | Types UNDEF {
+    $$ = UndefValue::get($1->get());
+    delete $1;
+  }
   | Types SymbolicValueRef {
     const PointerType *Ty = dyn_cast<PointerType>($1->get());
     if (Ty == 0)
@@ -1687,6 +1694,9 @@
   | NULL_TOK {
     $$ = ValID::createNull();
   }
+  | UNDEF {
+    $$ = ValID::createUndef();
+  }
   | '<' ConstVector '>' { // Nonempty unsized packed vector
     const Type *ETy = (*$2)[0]->getType();
     int NumElements = $2->size(); 
@@ -1858,6 +1868,9 @@
   }
   | UNWIND {
     $$ = new UnwindInst();
+  }
+  | UNREACHABLE {
+    $$ = new UnreachableInst();
   };