[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l ParserInternals.h llvmAsmParser.y

Reid Spencer reid at x10sys.com
Sun Nov 19 15:07:15 PST 2006



Changes in directory llvm/lib/AsmParser:

Lexer.l updated: 1.82 -> 1.83
ParserInternals.h updated: 1.46 -> 1.47
llvmAsmParser.y updated: 1.275 -> 1.276
---
Log message:

For PR950: http://llvm.org/PR950 :
Retain the signedness of the old integer types in a new TypeInfo structure
so that it can be used in the grammar to implement auto-upgrade of things
that depended on signedness of types. This doesn't implement any new 
functionality in the AsmParser, its just plumbing for future changes.


---
Diffs of the changes:  (+277 -215)

 Lexer.l           |   37 +++-
 ParserInternals.h |   26 +++
 llvmAsmParser.y   |  429 ++++++++++++++++++++++++++++--------------------------
 3 files changed, 277 insertions(+), 215 deletions(-)


Index: llvm/lib/AsmParser/Lexer.l
diff -u llvm/lib/AsmParser/Lexer.l:1.82 llvm/lib/AsmParser/Lexer.l:1.83
--- llvm/lib/AsmParser/Lexer.l:1.82	Wed Nov  8 00:47:33 2006
+++ llvm/lib/AsmParser/Lexer.l	Sun Nov 19 17:07:00 2006
@@ -51,6 +51,17 @@
   llvmAsmlval.type.obsolete = true; \
   return sym
 
+// Construct a token value for a non-obsolete type
+#define RET_TY(CType, sym) \
+  llvmAsmlval.TypeVal.type = new PATypeHolder(CType); \
+  llvmAsmlval.TypeVal.signedness = isSignless; \
+  return sym
+
+// Construct a token value for an obsolete token
+#define RET_TY_OBSOLETE(CType, sign, sym) \
+  llvmAsmlval.TypeVal.type = new PATypeHolder(CType); \
+  llvmAsmlval.TypeVal.signedness = sign; \
+  return sym
 
 namespace llvm {
 
@@ -238,19 +249,19 @@
 x86_stdcallcc   { return X86_STDCALLCC_TOK; }
 x86_fastcallcc  { return X86_FASTCALLCC_TOK; }
 
-void            { llvmAsmlval.PrimType = Type::VoidTy  ; return VOID;   }
-bool            { llvmAsmlval.PrimType = Type::BoolTy  ; return BOOL;   }
-sbyte           { llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE;  }
-ubyte           { llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE;  }
-short           { llvmAsmlval.PrimType = Type::ShortTy ; return SHORT;  }
-ushort          { llvmAsmlval.PrimType = Type::UShortTy; return USHORT; }
-int             { llvmAsmlval.PrimType = Type::IntTy   ; return INT;    }
-uint            { llvmAsmlval.PrimType = Type::UIntTy  ; return UINT;   }
-long            { llvmAsmlval.PrimType = Type::LongTy  ; return LONG;   }
-ulong           { llvmAsmlval.PrimType = Type::ULongTy ; return ULONG;  }
-float           { llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT;  }
-double          { llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; }
-label           { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL;  }
+void            { RET_TY(Type::VoidTy, VOID);  }
+bool            { RET_TY(Type::BoolTy, BOOL);  }
+sbyte           { RET_TY_OBSOLETE(Type::SByteTy, isSigned,   SBYTE); }
+ubyte           { RET_TY_OBSOLETE(Type::UByteTy, isUnsigned, UBYTE); }
+short           { RET_TY_OBSOLETE(Type::ShortTy, isSigned,   SHORT); }
+ushort          { RET_TY_OBSOLETE(Type::UShortTy,isUnsigned, USHORT); }
+int             { RET_TY_OBSOLETE(Type::IntTy,   isSigned,   INT);    }
+uint            { RET_TY_OBSOLETE(Type::UIntTy,  isUnsigned, UINT);   }
+long            { RET_TY_OBSOLETE(Type::LongTy,  isSigned,   LONG);   }
+ulong           { RET_TY_OBSOLETE(Type::ULongTy, isUnsigned, ULONG);  }
+float           { RET_TY(Type::FloatTy, FLOAT);  }
+double          { RET_TY(Type::DoubleTy, DOUBLE); }
+label           { RET_TY(Type::LabelTy,  LABEL);  }
 type            { return TYPE;   }
 opaque          { return OPAQUE; }
 


Index: llvm/lib/AsmParser/ParserInternals.h
diff -u llvm/lib/AsmParser/ParserInternals.h:1.46 llvm/lib/AsmParser/ParserInternals.h:1.47
--- llvm/lib/AsmParser/ParserInternals.h:1.46	Thu Oct 26 01:15:43 2006
+++ llvm/lib/AsmParser/ParserInternals.h	Sun Nov 19 17:07:00 2006
@@ -217,4 +217,30 @@
 typedef OpcodeInfo<llvm::Instruction::MemoryOps>  MemOpInfo;
 typedef OpcodeInfo<llvm::Instruction::OtherOps>   OtherOpInfo;
 
+/// This enumeration is used to indicate if a type is signed, signless or
+/// unsigned. It is used for backwards compatibility with assembly code that
+/// pre-dates the signless types conversion.
+enum Signedness {
+  isSigned,
+  isUnsigned,
+  isSignless
+};
+
+/// This structure is used to keep track of the signedness of the obsolete
+/// integer types. Instead of creating an llvm::Type directly, the Lexer will
+/// create instances of TypeInfo which retains the signedness indication so
+/// it can be used by the parser for upgrade decisions.
+/// For example if "uint" is encountered then the type will be set "int32" 
+/// and the "signedness" will be "isUnsigned".  If the type is not obsolete 
+/// then "signedness" will be "isSignless".
+struct TypeInfo {
+  llvm::PATypeHolder *type;
+  Signedness signedness;
+};
+
+struct ValueInfo {
+  std::vector<llvm::Value*> valuelist;
+  std::vector<Signedness>   signlist;
+};
+
 #endif


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.275 llvm/lib/AsmParser/llvmAsmParser.y:1.276
--- llvm/lib/AsmParser/llvmAsmParser.y:1.275	Sun Nov 12 05:10:39 2006
+++ llvm/lib/AsmParser/llvmAsmParser.y	Sun Nov 19 17:07:00 2006
@@ -83,8 +83,8 @@
   Module *CurrentModule;
   std::map<const Type *, ValueList> Values; // Module level numbered definitions
   std::map<const Type *,ValueList> LateResolveValues;
-  std::vector<PATypeHolder>    Types;
-  std::map<ValID, PATypeHolder> LateResolveTypes;
+  std::vector<TypeInfo>    Types;
+  std::map<ValID, TypeInfo> LateResolveTypes;
 
   /// PlaceHolderInfo - When temporary placeholder objects are created, remember
   /// how they were referenced and on which line of the input they came from so
@@ -217,7 +217,7 @@
   case ValID::NumberVal:               // Is it a numbered definition?
     // Module constants occupy the lowest numbered slots...
     if ((unsigned)D.Num < CurModule.Types.size())
-      return CurModule.Types[(unsigned)D.Num];
+      return CurModule.Types[(unsigned)D.Num].type->get();
     break;
   case ValID::NameVal:                 // Is it a named definition?
     if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
@@ -247,13 +247,15 @@
     }
   }
 
-  std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
+  std::map<ValID, TypeInfo>::iterator I =CurModule.LateResolveTypes.find(D);
   if (I != CurModule.LateResolveTypes.end())
-    return I->second;
+    return I->second.type->get();
 
-  Type *Typ = OpaqueType::get();
-  CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
-  return Typ;
+  TypeInfo TI;
+  TI.type = new PATypeHolder(OpaqueType::get());
+  TI.signedness = isSignless;
+  CurModule.LateResolveTypes.insert(std::make_pair(D, TI));
+  return TI.type->get();
  }
 
 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
@@ -557,10 +559,10 @@
   if (Name) D = ValID::create(Name);
   else      D = ValID::create((int)CurModule.Types.size());
 
-  std::map<ValID, PATypeHolder>::iterator I =
+  std::map<ValID, TypeInfo>::iterator I =
     CurModule.LateResolveTypes.find(D);
   if (I != CurModule.LateResolveTypes.end()) {
-    ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
+    ((DerivedType*)I->second.type->get())->refineAbstractTypeTo(ToTy);
     CurModule.LateResolveTypes.erase(I);
   }
 }
@@ -822,14 +824,13 @@
 /// instruction. This function handles converting div -> [usf]div appropriately.
 /// @brief Convert obsolete BinaryOps opcodes to new values
 static void 
-sanitizeOpCode(OpcodeInfo<Instruction::BinaryOps> &OI, const PATypeHolder& PATy)
+sanitizeOpCode(OpcodeInfo<Instruction::BinaryOps> &OI, const Type *Ty)
 {
   // If its not obsolete, don't do anything
   if (!OI.obsolete) 
     return;
 
   // If its a packed type we want to use the element type
-  const Type* Ty = PATy;
   if (const PackedType* PTy = dyn_cast<PackedType>(Ty))
     Ty = PTy->getElementType();
 
@@ -860,13 +861,12 @@
 /// operates on Instruction::OtherOps instead of Instruction::BinaryOps.
 /// @brief Convert obsolete OtherOps opcodes to new values
 static void 
-sanitizeOpCode(OpcodeInfo<Instruction::OtherOps> &OI, const PATypeHolder& PATy)
+sanitizeOpCode(OpcodeInfo<Instruction::OtherOps> &OI, const Type *Ty)
 {
   // If its not obsolete, don't do anything
   if (!OI.obsolete) 
     return;
 
-  const Type* Ty = PATy; // type conversion
   switch (OI.opcode) {
   default:
     GenerateError("Invalid obsolete opcode (check Lexer.l)");
@@ -1040,19 +1040,18 @@
 %union {
   llvm::Module                           *ModuleVal;
   llvm::Function                         *FunctionVal;
-  std::pair<llvm::PATypeHolder*, char*>  *ArgVal;
+  std::pair<TypeInfo, char*>             *ArgVal;
   llvm::BasicBlock                       *BasicBlockVal;
   llvm::TerminatorInst                   *TermInstVal;
   llvm::Instruction                      *InstVal;
   llvm::Constant                         *ConstVal;
 
-  const llvm::Type                       *PrimType;
-  llvm::PATypeHolder                     *TypeVal;
+  TypeInfo                                TypeVal;
   llvm::Value                            *ValueVal;
 
-  std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
+  std::vector<std::pair<TypeInfo,char*> >*ArgList;
   std::vector<llvm::Value*>              *ValueList;
-  std::list<llvm::PATypeHolder>          *TypeList;
+  std::list<TypeInfo>                    *TypeList;
   // Represent the RHS of PHI node
   std::list<std::pair<llvm::Value*,
                       llvm::BasicBlock*> > *PHIList;
@@ -1117,9 +1116,9 @@
 
 // Built in types...
 %type  <TypeVal> Types TypesV UpRTypes UpRTypesV
-%type  <PrimType> SIntType UIntType IntType FPType PrimType   // Classifications
-%token <PrimType> VOID BOOL SBYTE UBYTE SHORT USHORT INT UINT LONG ULONG
-%token <PrimType> FLOAT DOUBLE TYPE LABEL
+%type  <TypeVal> SIntType UIntType IntType FPType PrimType   // Classifications
+%token <TypeVal> VOID BOOL SBYTE UBYTE SHORT USHORT INT UINT LONG ULONG
+%token <TypeVal> FLOAT DOUBLE TYPE LABEL
 
 %token <StrVal> VAR_ID LABELSTR STRINGCONSTANT
 %type  <StrVal> Name OptName OptAssign
@@ -1279,15 +1278,22 @@
 //
 
 // TypesV includes all of 'Types', but it also includes the void type.
-TypesV    : Types    | VOID { $$ = new PATypeHolder($1); };
-UpRTypesV : UpRTypes | VOID { $$ = new PATypeHolder($1); };
+TypesV    : Types    | VOID { 
+    $$.type = new PATypeHolder($1.type->get());
+    $$.signedness = $1.signedness;
+};
+UpRTypesV : UpRTypes | VOID { 
+    $$.type = new PATypeHolder($1.type->get()); 
+    $$.signedness = $1.signedness;
+};
 
 Types     : UpRTypes {
     if (!UpRefs.empty())
-      GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription());
+      GEN_ERROR("Invalid upreference in type: " + 
+        ($1.type->get())->getDescription());
     $$ = $1;
     CHECK_FOR_ERROR
-  };
+};
 
 
 // Derived types are added later...
@@ -1295,17 +1301,19 @@
 PrimType : BOOL | SBYTE | UBYTE | SHORT  | USHORT | INT   | UINT ;
 PrimType : LONG | ULONG | FLOAT | DOUBLE | TYPE   | LABEL;
 UpRTypes : OPAQUE {
-    $$ = new PATypeHolder(OpaqueType::get());
+    $$.type = new PATypeHolder(OpaqueType::get());
+    $$.signedness = isSignless;
     CHECK_FOR_ERROR
   }
   | PrimType {
-    $$ = new PATypeHolder($1);
+    $$ = $1;
     CHECK_FOR_ERROR
   };
 UpRTypes : SymbolicValueRef {            // Named types are also simple types...
   const Type* tmp = getTypeVal($1);
   CHECK_FOR_ERROR
-  $$ = new PATypeHolder(tmp);
+  $$.type = new PATypeHolder(tmp);
+  $$.signedness = isSignless;
 };
 
 // Include derived types in the Types production.
@@ -1314,59 +1322,69 @@
     if ($2 > (uint64_t)~0U) GEN_ERROR("Value out of range!");
     OpaqueType *OT = OpaqueType::get();        // Use temporary placeholder
     UpRefs.push_back(UpRefRecord((unsigned)$2, OT));  // Add to vector...
-    $$ = new PATypeHolder(OT);
+    $$.type = new PATypeHolder(OT);
+    $$.signedness = isSignless;
     UR_OUT("New Upreference!\n");
     CHECK_FOR_ERROR
   }
   | UpRTypesV '(' ArgTypeListI ')' {           // Function derived type?
     std::vector<const Type*> Params;
-    for (std::list<llvm::PATypeHolder>::iterator I = $3->begin(),
+    for (std::list<TypeInfo>::iterator I = $3->begin(),
            E = $3->end(); I != E; ++I)
-      Params.push_back(*I);
+      Params.push_back(I->type->get());
     bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
     if (isVarArg) Params.pop_back();
 
-    $$ = new PATypeHolder(HandleUpRefs(FunctionType::get(*$1,Params,isVarArg)));
+    $$.type = new PATypeHolder(HandleUpRefs(
+               FunctionType::get($1.type->get(),Params,isVarArg)));
+    $$.signedness = isSignless;
     delete $3;      // Delete the argument list
-    delete $1;      // Delete the return type handle
+    delete $1.type;
     CHECK_FOR_ERROR
   }
   | '[' EUINT64VAL 'x' UpRTypes ']' {          // Sized array type?
-    $$ = new PATypeHolder(HandleUpRefs(ArrayType::get(*$4, (unsigned)$2)));
-    delete $4;
+    $$.type = new PATypeHolder(HandleUpRefs(
+      ArrayType::get($4.type->get(), (unsigned)$2)));
+    $$.signedness = isSignless;
+    delete $4.type;
     CHECK_FOR_ERROR
   }
   | '<' EUINT64VAL 'x' UpRTypes '>' {          // Packed array type?
-     const llvm::Type* ElemTy = $4->get();
-     if ((unsigned)$2 != $2)
-        GEN_ERROR("Unsigned result not equal to signed result");
-     if (!ElemTy->isPrimitiveType())
-        GEN_ERROR("Elemental type of a PackedType must be primitive");
-     if (!isPowerOf2_32($2))
-       GEN_ERROR("Vector length should be a power of 2!");
-     $$ = new PATypeHolder(HandleUpRefs(PackedType::get(*$4, (unsigned)$2)));
-     delete $4;
-     CHECK_FOR_ERROR
+    const llvm::Type* ElemTy = $4.type->get();
+    if ((unsigned)$2 != $2)
+      GEN_ERROR("Unsigned result not equal to signed result");
+    if (!ElemTy->isPrimitiveType())
+      GEN_ERROR("Elemental type of a PackedType must be primitive");
+    if (!isPowerOf2_32($2))
+      GEN_ERROR("Vector length should be a power of 2!");
+    $$.type = new PATypeHolder(HandleUpRefs(
+                PackedType::get($4.type->get(), (unsigned)$2)));
+    $$.signedness = isSignless;
+    delete $4.type;
+    CHECK_FOR_ERROR
   }
   | '{' TypeListI '}' {                        // Structure type?
     std::vector<const Type*> Elements;
-    for (std::list<llvm::PATypeHolder>::iterator I = $2->begin(),
+    for (std::list<TypeInfo>::iterator I = $2->begin(),
            E = $2->end(); I != E; ++I)
-      Elements.push_back(*I);
+      Elements.push_back(I->type->get());
 
-    $$ = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
+    $$.type = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
+    $$.signedness = isSignless;
     delete $2;
     CHECK_FOR_ERROR
   }
   | '{' '}' {                                  // Empty structure type?
-    $$ = new PATypeHolder(StructType::get(std::vector<const Type*>()));
+    $$.type = new PATypeHolder(StructType::get(std::vector<const Type*>()));
+    $$.signedness = isSignless;
     CHECK_FOR_ERROR
   }
   | UpRTypes '*' {                             // Pointer type?
-    if (*$1 == Type::LabelTy)
+    if ($1.type->get() == Type::LabelTy)
       GEN_ERROR("Cannot form a pointer to a basic block");
-    $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1)));
-    delete $1;
+    $$.type = new PATypeHolder(HandleUpRefs(PointerType::get($1.type->get())));
+    $$.signedness = $1.signedness;
+    delete $1.type;
     CHECK_FOR_ERROR
   };
 
@@ -1374,27 +1392,31 @@
 // declaration type lists
 //
 TypeListI : UpRTypes {
-    $$ = new std::list<PATypeHolder>();
-    $$->push_back(*$1); delete $1;
+    $$ = new std::list<TypeInfo>();
+    $$->push_back($1);
     CHECK_FOR_ERROR
   }
   | TypeListI ',' UpRTypes {
-    ($$=$1)->push_back(*$3); delete $3;
+    ($$=$1)->push_back($3);
     CHECK_FOR_ERROR
   };
 
 // ArgTypeList - List of types for a function type declaration...
 ArgTypeListI : TypeListI
   | TypeListI ',' DOTDOTDOT {
-    ($$=$1)->push_back(Type::VoidTy);
+    TypeInfo TI; 
+    TI.type = new PATypeHolder(Type::VoidTy); TI.signedness = isSignless;
+    ($$=$1)->push_back(TI);
     CHECK_FOR_ERROR
   }
   | DOTDOTDOT {
-    ($$ = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
+    TypeInfo TI; 
+    TI.type = new PATypeHolder(Type::VoidTy); TI.signedness = isSignless;
+    ($$ = new std::list<TypeInfo>())->push_back(TI);
     CHECK_FOR_ERROR
   }
   | /*empty*/ {
-    $$ = new std::list<PATypeHolder>();
+    $$ = new std::list<TypeInfo>();
     CHECK_FOR_ERROR
   };
 
@@ -1405,10 +1427,10 @@
 // ResolvedVal, ValueRef and ConstValueRef productions.
 //
 ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
-    const ArrayType *ATy = dyn_cast<ArrayType>($1->get());
+    const ArrayType *ATy = dyn_cast<ArrayType>($1.type->get());
     if (ATy == 0)
       GEN_ERROR("Cannot make array constant with type: '" + 
-                     (*$1)->getDescription() + "'!");
+                     ($1.type->get())->getDescription() + "'!");
     const Type *ETy = ATy->getElementType();
     int NumElements = ATy->getNumElements();
 
@@ -1427,28 +1449,28 @@
     }
 
     $$ = ConstantArray::get(ATy, *$3);
-    delete $1; delete $3;
+    delete $1.type; delete $3;
     CHECK_FOR_ERROR
   }
   | Types '[' ']' {
-    const ArrayType *ATy = dyn_cast<ArrayType>($1->get());
+    const ArrayType *ATy = dyn_cast<ArrayType>($1.type->get());
     if (ATy == 0)
       GEN_ERROR("Cannot make array constant with type: '" + 
-                     (*$1)->getDescription() + "'!");
+                     ($1.type->get())->getDescription() + "'!");
 
     int NumElements = ATy->getNumElements();
     if (NumElements != -1 && NumElements != 0) 
       GEN_ERROR("Type mismatch: constant sized array initialized with 0"
                      " arguments, but has size of " + itostr(NumElements) +"!");
     $$ = ConstantArray::get(ATy, std::vector<Constant*>());
-    delete $1;
+    delete $1.type;
     CHECK_FOR_ERROR
   }
   | Types 'c' STRINGCONSTANT {
-    const ArrayType *ATy = dyn_cast<ArrayType>($1->get());
+    const ArrayType *ATy = dyn_cast<ArrayType>($1.type->get());
     if (ATy == 0)
       GEN_ERROR("Cannot make array constant with type: '" + 
-                     (*$1)->getDescription() + "'!");
+                     ($1.type->get())->getDescription() + "'!");
 
     int NumElements = ATy->getNumElements();
     const Type *ETy = ATy->getElementType();
@@ -1471,14 +1493,14 @@
     }
     free($3);
     $$ = ConstantArray::get(ATy, Vals);
-    delete $1;
+    delete $1.type;
     CHECK_FOR_ERROR
   }
   | Types '<' ConstVector '>' { // Nonempty unsized arr
-    const PackedType *PTy = dyn_cast<PackedType>($1->get());
+    const PackedType *PTy = dyn_cast<PackedType>($1.type->get());
     if (PTy == 0)
       GEN_ERROR("Cannot make packed constant with type: '" + 
-                     (*$1)->getDescription() + "'!");
+                     $1.type->get()->getDescription() + "'!");
     const Type *ETy = PTy->getElementType();
     int NumElements = PTy->getNumElements();
 
@@ -1497,14 +1519,14 @@
     }
 
     $$ = ConstantPacked::get(PTy, *$3);
-    delete $1; delete $3;
+    delete $1.type; delete $3;
     CHECK_FOR_ERROR
   }
   | Types '{' ConstVector '}' {
-    const StructType *STy = dyn_cast<StructType>($1->get());
+    const StructType *STy = dyn_cast<StructType>($1.type->get());
     if (STy == 0)
       GEN_ERROR("Cannot make struct constant with type: '" + 
-                     (*$1)->getDescription() + "'!");
+                     $1.type->get()->getDescription() + "'!");
 
     if ($3->size() != STy->getNumContainedTypes())
       GEN_ERROR("Illegal number of initializers for structure type!");
@@ -1518,39 +1540,39 @@
                        " of structure initializer!");
 
     $$ = ConstantStruct::get(STy, *$3);
-    delete $1; delete $3;
+    delete $1.type; delete $3;
     CHECK_FOR_ERROR
   }
   | Types '{' '}' {
-    const StructType *STy = dyn_cast<StructType>($1->get());
+    const StructType *STy = dyn_cast<StructType>($1.type->get());
     if (STy == 0)
       GEN_ERROR("Cannot make struct constant with type: '" + 
-                     (*$1)->getDescription() + "'!");
+                     $1.type->get()->getDescription() + "'!");
 
     if (STy->getNumContainedTypes() != 0)
       GEN_ERROR("Illegal number of initializers for structure type!");
 
     $$ = ConstantStruct::get(STy, std::vector<Constant*>());
-    delete $1;
+    delete $1.type;
     CHECK_FOR_ERROR
   }
   | Types NULL_TOK {
-    const PointerType *PTy = dyn_cast<PointerType>($1->get());
+    const PointerType *PTy = dyn_cast<PointerType>($1.type->get());
     if (PTy == 0)
       GEN_ERROR("Cannot make null pointer constant with type: '" + 
-                     (*$1)->getDescription() + "'!");
+                     $1.type->get()->getDescription() + "'!");
 
     $$ = ConstantPointerNull::get(PTy);
-    delete $1;
+    delete $1.type;
     CHECK_FOR_ERROR
   }
   | Types UNDEF {
-    $$ = UndefValue::get($1->get());
-    delete $1;
+    $$ = UndefValue::get($1.type->get());
+    delete $1.type;
     CHECK_FOR_ERROR
   }
   | Types SymbolicValueRef {
-    const PointerType *Ty = dyn_cast<PointerType>($1->get());
+    const PointerType *Ty = dyn_cast<PointerType>($1.type->get());
     if (Ty == 0)
       GEN_ERROR("Global const reference must be a pointer type!");
 
@@ -1607,35 +1629,35 @@
     }
 
     $$ = cast<GlobalValue>(V);
-    delete $1;            // Free the type handle
+    delete $1.type;            // Free the type handle
     CHECK_FOR_ERROR
   }
   | Types ConstExpr {
-    if ($1->get() != $2->getType())
+    if ($1.type->get() != $2->getType())
       GEN_ERROR("Mismatched types for constant expression!");
     $$ = $2;
-    delete $1;
+    delete $1.type;
     CHECK_FOR_ERROR
   }
   | Types ZEROINITIALIZER {
-    const Type *Ty = $1->get();
+    const Type *Ty = $1.type->get();
     if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
       GEN_ERROR("Cannot create a null initialized value of this type!");
     $$ = Constant::getNullValue(Ty);
-    delete $1;
+    delete $1.type;
     CHECK_FOR_ERROR
   };
 
 ConstVal : SIntType EINT64VAL {      // integral constants
-    if (!ConstantInt::isValueValidForType($1, $2))
+    if (!ConstantInt::isValueValidForType($1.type->get(), $2))
       GEN_ERROR("Constant value doesn't fit in type!");
-    $$ = ConstantInt::get($1, $2);
+    $$ = ConstantInt::get($1.type->get(), $2);
     CHECK_FOR_ERROR
   }
   | UIntType EUINT64VAL {            // integral constants
-    if (!ConstantInt::isValueValidForType($1, $2))
+    if (!ConstantInt::isValueValidForType($1.type->get(), $2))
       GEN_ERROR("Constant value doesn't fit in type!");
-    $$ = ConstantInt::get($1, $2);
+    $$ = ConstantInt::get($1.type->get(), $2);
     CHECK_FOR_ERROR
   }
   | BOOL TRUETOK {                      // Boolean constants
@@ -1647,9 +1669,9 @@
     CHECK_FOR_ERROR
   }
   | FPType FPVAL {                   // Float & Double constants
-    if (!ConstantFP::isValueValidForType($1, $2))
+    if (!ConstantFP::isValueValidForType($1.type->get(), $2))
       GEN_ERROR("Floating point constant invalid for type!!");
-    $$ = ConstantFP::get($1, $2);
+    $$ = ConstantFP::get($1.type->get(), $2);
     CHECK_FOR_ERROR
   };
 
@@ -1658,11 +1680,11 @@
     if (!$3->getType()->isFirstClassType())
       GEN_ERROR("cast constant expression from a non-primitive type: '" +
                      $3->getType()->getDescription() + "'!");
-    if (!$5->get()->isFirstClassType())
+    if (!$5.type->get()->isFirstClassType())
       GEN_ERROR("cast constant expression to a non-primitive type: '" +
-                     $5->get()->getDescription() + "'!");
-    $$ = ConstantExpr::getCast($3, $5->get());
-    delete $5;
+                     $5.type->get()->getDescription() + "'!");
+    $$ = ConstantExpr::getCast($3, $5.type->get());
+    delete $5.type;
     CHECK_FOR_ERROR
   }
   | GETELEMENTPTR '(' ConstVal IndexList ')' {
@@ -1853,16 +1875,16 @@
     // If types are not resolved eagerly, then the two types will not be
     // determined to be the same type!
     //
-    ResolveTypeTo($2, *$4);
+    ResolveTypeTo($2, $4.type->get());
 
-    if (!setTypeName(*$4, $2) && !$2) {
+    if (!setTypeName($4.type->get(), $2) && !$2) {
       CHECK_FOR_ERROR
       // If this is a named type that is not a redefinition, add it to the slot
       // table.
-      CurModule.Types.push_back(*$4);
+      CurModule.Types.push_back($4);
+    } else {
+      delete $4.type;
     }
-
-    delete $4;
     CHECK_FOR_ERROR
   }
   | ConstPool FunctionProto {       // Function prototypes can be in const pool
@@ -1880,26 +1902,29 @@
     CurGV = 0;
   }
   | ConstPool OptAssign EXTERNAL GlobalType Types {
-    CurGV = ParseGlobalVariable($2, GlobalValue::ExternalLinkage, $4, *$5, 0);
+    CurGV = ParseGlobalVariable($2, GlobalValue::ExternalLinkage, $4,
+      $5.type->get(), 0);
     CHECK_FOR_ERROR
-    delete $5;
+    delete $5.type;
   } GlobalVarAttributes {
     CurGV = 0;
     CHECK_FOR_ERROR
   }
   | ConstPool OptAssign DLLIMPORT GlobalType Types {
-    CurGV = ParseGlobalVariable($2, GlobalValue::DLLImportLinkage, $4, *$5, 0);
+    CurGV = ParseGlobalVariable($2, GlobalValue::DLLImportLinkage, $4,
+      $5.type->get(), 0);
     CHECK_FOR_ERROR
-    delete $5;
+    delete $5.type;
   } GlobalVarAttributes {
     CurGV = 0;
     CHECK_FOR_ERROR
   }
   | ConstPool OptAssign EXTERN_WEAK GlobalType Types {
     CurGV = 
-      ParseGlobalVariable($2, GlobalValue::ExternalWeakLinkage, $4, *$5, 0);
+      ParseGlobalVariable($2, GlobalValue::ExternalWeakLinkage, $4,
+        $5.type->get(), 0);
     CHECK_FOR_ERROR
-    delete $5;
+    delete $5.type;
   } GlobalVarAttributes {
     CurGV = 0;
     CHECK_FOR_ERROR
@@ -1977,9 +2002,9 @@
 OptName : Name | /*empty*/ { $$ = 0; };
 
 ArgVal : Types OptName {
-  if (*$1 == Type::VoidTy)
+  if ($1.type->get() == Type::VoidTy)
     GEN_ERROR("void typed arguments are invalid!");
-  $$ = new std::pair<PATypeHolder*, char*>($1, $2);
+  $$ = new std::pair<TypeInfo, char*>($1, $2);
   CHECK_FOR_ERROR
 };
 
@@ -1990,7 +2015,7 @@
     CHECK_FOR_ERROR
   }
   | ArgVal {
-    $$ = new std::vector<std::pair<PATypeHolder*,char*> >();
+    $$ = new std::vector<std::pair<TypeInfo,char*> >();
     $$->push_back(*$1);
     delete $1;
     CHECK_FOR_ERROR
@@ -2002,13 +2027,18 @@
   }
   | ArgListH ',' DOTDOTDOT {
     $$ = $1;
-    $$->push_back(std::pair<PATypeHolder*,
-                            char*>(new PATypeHolder(Type::VoidTy), 0));
+    TypeInfo TI;
+    TI.type = new PATypeHolder(Type::VoidTy);
+    TI.signedness = isSignless;
+    $$->push_back(std::pair<TypeInfo,char*>(TI,(char*)0));
     CHECK_FOR_ERROR
   }
   | DOTDOTDOT {
-    $$ = new std::vector<std::pair<PATypeHolder*,char*> >();
-    $$->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
+    $$ = new std::vector<std::pair<TypeInfo,char*> >();
+    TypeInfo TI;
+    TI.type = new PATypeHolder(Type::VoidTy);
+    TI.signedness = isSignless;
+    $$->push_back(std::make_pair(TI, (char*)0));
     CHECK_FOR_ERROR
   }
   | /* empty */ {
@@ -2022,22 +2052,23 @@
   std::string FunctionName($3);
   free($3);  // Free strdup'd memory!
   
-  if (!(*$2)->isFirstClassType() && *$2 != Type::VoidTy)
+  if (!($2.type->get())->isFirstClassType() && $2.type->get() != Type::VoidTy)
     GEN_ERROR("LLVM functions cannot return aggregate types!");
 
   std::vector<const Type*> ParamTypeList;
   if ($5) {   // If there are arguments...
-    for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = $5->begin();
+    for (std::vector<std::pair<TypeInfo,char*> >::iterator I = $5->begin();
          I != $5->end(); ++I)
-      ParamTypeList.push_back(I->first->get());
+      ParamTypeList.push_back(I->first.type->get());
   }
 
   bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
   if (isVarArg) ParamTypeList.pop_back();
 
-  const FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg);
+  const FunctionType *FT = FunctionType::get($2.type->get(), ParamTypeList, 
+    isVarArg);
   const PointerType *PFT = PointerType::get(FT);
-  delete $2;
+  delete $2.type;
 
   ValID ID;
   if (!FunctionName.empty()) {
@@ -2091,21 +2122,19 @@
   // Add all of the arguments we parsed to the function...
   if ($5) {                     // Is null if empty...
     if (isVarArg) {  // Nuke the last entry
-      assert($5->back().first->get() == Type::VoidTy && $5->back().second == 0&&
-             "Not a varargs marker!");
-      delete $5->back().first;
+      assert($5->back().first.type->get() == Type::VoidTy && 
+             $5->back().second == 0 && "Not a varargs marker!");
+      delete $5->back().first.type;
       $5->pop_back();  // Delete the last entry
     }
     Function::arg_iterator ArgIt = Fn->arg_begin();
-    for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = $5->begin();
+    for (std::vector<std::pair<TypeInfo,char*> >::iterator I = $5->begin();
          I != $5->end(); ++I, ++ArgIt) {
-      delete I->first;                          // Delete the typeholder...
-
+      delete I->first.type;                     // Delete the typeholder...
       setValueName(ArgIt, I->second);           // Insert arg into symtab...
       CHECK_FOR_ERROR
       InsertValue(ArgIt);
     }
-
     delete $5;                     // We're now done with the argument list
   }
   CHECK_FOR_ERROR
@@ -2189,12 +2218,7 @@
     
     PackedType* pt = PackedType::get(ETy, NumElements);
     PATypeHolder* PTy = new PATypeHolder(
-                                         HandleUpRefs(
-                                            PackedType::get(
-                                                ETy, 
-                                                NumElements)
-                                            )
-                                         );
+       HandleUpRefs(PackedType::get( ETy, NumElements)));
     
     // Verify all elements are correct type!
     for (unsigned i = 0; i < $2->size(); i++) {
@@ -2243,7 +2267,7 @@
 // type immediately preceeds the value reference, and allows complex constant
 // pool references (for things like: 'ret [2 x int] [ int 12, int 42]')
 ResolvedVal : Types ValueRef {
-    $$ = getVal(*$1, $2); delete $1;
+    $$ = getVal($1.type->get(), $2); delete $1.type;
     CHECK_FOR_ERROR
   };
 
@@ -2324,7 +2348,7 @@
     $$ = new BranchInst(tmpBBA, tmpBBB, tmpVal);
   }
   | SWITCH IntType ValueRef ',' LABEL ValueRef '[' JumpTable ']' {
-    Value* tmpVal = getVal($2, $3);
+    Value* tmpVal = getVal($2.type->get(), $3);
     CHECK_FOR_ERROR
     BasicBlock* tmpBB = getBBVal($6);
     CHECK_FOR_ERROR
@@ -2343,7 +2367,7 @@
     CHECK_FOR_ERROR
   }
   | SWITCH IntType ValueRef ',' LABEL ValueRef '[' ']' {
-    Value* tmpVal = getVal($2, $3);
+    Value* tmpVal = getVal($2.type->get(), $3);
     CHECK_FOR_ERROR
     BasicBlock* tmpBB = getBBVal($6);
     CHECK_FOR_ERROR
@@ -2356,7 +2380,7 @@
     const PointerType *PFTy;
     const FunctionType *Ty;
 
-    if (!(PFTy = dyn_cast<PointerType>($3->get())) ||
+    if (!(PFTy = dyn_cast<PointerType>($3.type->get())) ||
         !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
       // Pull out the types of all of the arguments...
       std::vector<const Type*> ParamTypes;
@@ -2369,7 +2393,7 @@
       bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
       if (isVarArg) ParamTypes.pop_back();
 
-      Ty = FunctionType::get($3->get(), ParamTypes, isVarArg);
+      Ty = FunctionType::get($3.type->get(), ParamTypes, isVarArg);
       PFTy = PointerType::get(Ty);
     }
 
@@ -2403,7 +2427,7 @@
     }
     cast<InvokeInst>($$)->setCallingConv($2);
   
-    delete $3;
+    delete $3.type;
     delete $6;
     CHECK_FOR_ERROR
   }
@@ -2420,7 +2444,7 @@
 
 JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef {
     $$ = $1;
-    Constant *V = cast<Constant>(getValNonImprovising($2, $3));
+    Constant *V = cast<Constant>(getValNonImprovising($2.type->get(), $3));
     CHECK_FOR_ERROR
     if (V == 0)
       GEN_ERROR("May only switch on a constant pool value!");
@@ -2431,7 +2455,7 @@
   }
   | IntType ConstValueRef ',' LABEL ValueRef {
     $$ = new std::vector<std::pair<Constant*, BasicBlock*> >();
-    Constant *V = cast<Constant>(getValNonImprovising($1, $2));
+    Constant *V = cast<Constant>(getValNonImprovising($1.type->get(), $2));
     CHECK_FOR_ERROR
 
     if (V == 0)
@@ -2453,12 +2477,12 @@
 
 PHIList : Types '[' ValueRef ',' ValueRef ']' {    // Used for PHI nodes
     $$ = new std::list<std::pair<Value*, BasicBlock*> >();
-    Value* tmpVal = getVal(*$1, $3);
+    Value* tmpVal = getVal($1.type->get(), $3);
     CHECK_FOR_ERROR
     BasicBlock* tmpBB = getBBVal($5);
     CHECK_FOR_ERROR
     $$->push_back(std::make_pair(tmpVal, tmpBB));
-    delete $1;
+    delete $1.type;
   }
   | PHIList ',' '[' ValueRef ',' ValueRef ']' {
     $$ = $1;
@@ -2493,55 +2517,55 @@
   };
 
 InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
-    if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() && 
-        !isa<PackedType>((*$2).get()))
+    if (!$2.type->get()->isInteger() && !$2.type->get()->isFloatingPoint() && 
+        !isa<PackedType>($2.type->get()))
       GEN_ERROR(
         "Arithmetic operator requires integer, FP, or packed operands!");
-    if (isa<PackedType>((*$2).get()) && 
+    if (isa<PackedType>($2.type->get()) && 
         ($1.opcode == Instruction::URem || 
          $1.opcode == Instruction::SRem ||
          $1.opcode == Instruction::FRem))
       GEN_ERROR("U/S/FRem not supported on packed types!");
     // Upgrade the opcode from obsolete versions before we do anything with it.
-    sanitizeOpCode($1,*$2);
+    sanitizeOpCode($1,$2.type->get());
     CHECK_FOR_ERROR;
-    Value* val1 = getVal(*$2, $3); 
+    Value* val1 = getVal($2.type->get(), $3); 
     CHECK_FOR_ERROR
-    Value* val2 = getVal(*$2, $5);
+    Value* val2 = getVal($2.type->get(), $5);
     CHECK_FOR_ERROR
     $$ = BinaryOperator::create($1.opcode, val1, val2);
     if ($$ == 0)
       GEN_ERROR("binary operator returned null!");
-    delete $2;
+    delete $2.type;
   }
   | LogicalOps Types ValueRef ',' ValueRef {
-    if (!(*$2)->isIntegral()) {
-      if (!isa<PackedType>($2->get()) ||
-          !cast<PackedType>($2->get())->getElementType()->isIntegral())
+    if (!$2.type->get()->isIntegral()) {
+      if (!isa<PackedType>($2.type->get()) ||
+          !cast<PackedType>($2.type->get())->getElementType()->isIntegral())
         GEN_ERROR("Logical operator requires integral operands!");
     }
-    Value* tmpVal1 = getVal(*$2, $3);
+    Value* tmpVal1 = getVal($2.type->get(), $3);
     CHECK_FOR_ERROR
-    Value* tmpVal2 = getVal(*$2, $5);
+    Value* tmpVal2 = getVal($2.type->get(), $5);
     CHECK_FOR_ERROR
     $$ = BinaryOperator::create($1.opcode, tmpVal1, tmpVal2);
     if ($$ == 0)
       GEN_ERROR("binary operator returned null!");
-    delete $2;
+    delete $2.type;
   }
   | SetCondOps Types ValueRef ',' ValueRef {
-    if(isa<PackedType>((*$2).get())) {
+    if(isa<PackedType>($2.type->get())) {
       GEN_ERROR(
         "PackedTypes currently not supported in setcc instructions!");
     }
-    Value* tmpVal1 = getVal(*$2, $3);
+    Value* tmpVal1 = getVal($2.type->get(), $3);
     CHECK_FOR_ERROR
-    Value* tmpVal2 = getVal(*$2, $5);
+    Value* tmpVal2 = getVal($2.type->get(), $5);
     CHECK_FOR_ERROR
     $$ = new SetCondInst($1.opcode, tmpVal1, tmpVal2);
     if ($$ == 0)
       GEN_ERROR("binary operator returned null!");
-    delete $2;
+    delete $2.type;
   }
   | NOT ResolvedVal {
     std::cerr << "WARNING: Use of eliminated 'not' instruction:"
@@ -2568,11 +2592,11 @@
     CHECK_FOR_ERROR
   }
   | CAST ResolvedVal TO Types {
-    if (!$4->get()->isFirstClassType())
+    if (!$4.type->get()->isFirstClassType())
       GEN_ERROR("cast instruction to a non-primitive type: '" +
-                     $4->get()->getDescription() + "'!");
-    $$ = new CastInst($2, *$4);
-    delete $4;
+                     $4.type->get()->getDescription() + "'!");
+    $$ = new CastInst($2, $4.type->get());
+    delete $4.type;
     CHECK_FOR_ERROR
   }
   | SELECT ResolvedVal ',' ResolvedVal ',' ResolvedVal {
@@ -2585,8 +2609,8 @@
   }
   | VAARG ResolvedVal ',' Types {
     NewVarArgs = true;
-    $$ = new VAArgInst($2, *$4);
-    delete $4;
+    $$ = new VAArgInst($2, $4.type->get());
+    delete $4.type;
     CHECK_FOR_ERROR
   }
   | VAARG_old ResolvedVal ',' Types {
@@ -2605,8 +2629,8 @@
     CallInst* bar = new CallInst(NF, $2);
     CurBB->getInstList().push_back(bar);
     CurBB->getInstList().push_back(new StoreInst(bar, foo));
-    $$ = new VAArgInst(foo, *$4);
-    delete $4;
+    $$ = new VAArgInst(foo, $4.type->get());
+    delete $4.type;
     CHECK_FOR_ERROR
   }
   | VANEXT_old ResolvedVal ',' Types {
@@ -2626,10 +2650,10 @@
     CallInst* bar = new CallInst(NF, $2);
     CurBB->getInstList().push_back(bar);
     CurBB->getInstList().push_back(new StoreInst(bar, foo));
-    Instruction* tmp = new VAArgInst(foo, *$4);
+    Instruction* tmp = new VAArgInst(foo, $4.type->get());
     CurBB->getInstList().push_back(tmp);
     $$ = new LoadInst(foo);
-    delete $4;
+    delete $4.type;
     CHECK_FOR_ERROR
   }
   | EXTRACTELEMENT ResolvedVal ',' ResolvedVal {
@@ -2669,7 +2693,7 @@
     const PointerType *PFTy = 0;
     const FunctionType *Ty = 0;
 
-    if (!(PFTy = dyn_cast<PointerType>($3->get())) ||
+    if (!(PFTy = dyn_cast<PointerType>($3.type->get())) ||
         !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
       // Pull out the types of all of the arguments...
       std::vector<const Type*> ParamTypes;
@@ -2682,10 +2706,11 @@
       bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
       if (isVarArg) ParamTypes.pop_back();
 
-      if (!(*$3)->isFirstClassType() && *$3 != Type::VoidTy)
+      if (!$3.type->get()->isFirstClassType() && 
+           $3.type->get() != Type::VoidTy)
         GEN_ERROR("LLVM functions cannot return aggregate types!");
 
-      Ty = FunctionType::get($3->get(), ParamTypes, isVarArg);
+      Ty = FunctionType::get($3.type->get(), ParamTypes, isVarArg);
       PFTy = PointerType::get(Ty);
     }
 
@@ -2720,7 +2745,7 @@
     }
     cast<CallInst>($$)->setTailCall($1);
     cast<CallInst>($$)->setCallingConv($2);
-    delete $3;
+    delete $3.type;
     delete $6;
     CHECK_FOR_ERROR
   }
@@ -2751,26 +2776,26 @@
 
 
 MemoryInst : MALLOC Types OptCAlign {
-    $$ = new MallocInst(*$2, 0, $3);
-    delete $2;
+    $$ = new MallocInst($2.type->get(), 0, $3);
+    delete $2.type;
     CHECK_FOR_ERROR
   }
   | MALLOC Types ',' UINT ValueRef OptCAlign {
-    Value* tmpVal = getVal($4, $5);
+    Value* tmpVal = getVal($4.type->get(), $5);
     CHECK_FOR_ERROR
-    $$ = new MallocInst(*$2, tmpVal, $6);
-    delete $2;
+    $$ = new MallocInst($2.type->get(), tmpVal, $6);
+    delete $2.type;
   }
   | ALLOCA Types OptCAlign {
-    $$ = new AllocaInst(*$2, 0, $3);
-    delete $2;
+    $$ = new AllocaInst($2.type->get(), 0, $3);
+    delete $2.type;
     CHECK_FOR_ERROR
   }
   | ALLOCA Types ',' UINT ValueRef OptCAlign {
-    Value* tmpVal = getVal($4, $5);
+    Value* tmpVal = getVal($4.type->get(), $5);
     CHECK_FOR_ERROR
-    $$ = new AllocaInst(*$2, tmpVal, $6);
-    delete $2;
+    $$ = new AllocaInst($2.type->get(), tmpVal, $6);
+    delete $2.type;
   }
   | FREE ResolvedVal {
     if (!isa<PointerType>($2->getType()))
@@ -2781,54 +2806,54 @@
   }
 
   | OptVolatile LOAD Types ValueRef {
-    if (!isa<PointerType>($3->get()))
+    if (!isa<PointerType>($3.type->get()))
       GEN_ERROR("Can't load from nonpointer type: " +
-                     (*$3)->getDescription());
-    if (!cast<PointerType>($3->get())->getElementType()->isFirstClassType())
+                     $3.type->get()->getDescription());
+    if (!cast<PointerType>($3.type->get())->getElementType()->isFirstClassType())
       GEN_ERROR("Can't load from pointer of non-first-class type: " +
-                     (*$3)->getDescription());
-    Value* tmpVal = getVal(*$3, $4);
+                     $3.type->get()->getDescription());
+    Value* tmpVal = getVal($3.type->get(), $4);
     CHECK_FOR_ERROR
     $$ = new LoadInst(tmpVal, "", $1);
-    delete $3;
+    delete $3.type;
   }
   | OptVolatile STORE ResolvedVal ',' Types ValueRef {
-    const PointerType *PT = dyn_cast<PointerType>($5->get());
+    const PointerType *PT = dyn_cast<PointerType>($5.type->get());
     if (!PT)
       GEN_ERROR("Can't store to a nonpointer type: " +
-                     (*$5)->getDescription());
+                     ($5.type->get())->getDescription());
     const Type *ElTy = PT->getElementType();
     if (ElTy != $3->getType())
       GEN_ERROR("Can't store '" + $3->getType()->getDescription() +
                      "' into space of type '" + ElTy->getDescription() + "'!");
 
-    Value* tmpVal = getVal(*$5, $6);
+    Value* tmpVal = getVal($5.type->get(), $6);
     CHECK_FOR_ERROR
     $$ = new StoreInst($3, tmpVal, $1);
-    delete $5;
+    delete $5.type;
   }
   | GETELEMENTPTR Types ValueRef IndexList {
-    if (!isa<PointerType>($2->get()))
+    if (!isa<PointerType>($2.type->get()))
       GEN_ERROR("getelementptr insn requires pointer operand!");
 
     // LLVM 1.2 and earlier used ubyte struct indices.  Convert any ubyte struct
     // indices to uint struct indices for compatibility.
     generic_gep_type_iterator<std::vector<Value*>::iterator>
-      GTI = gep_type_begin($2->get(), $4->begin(), $4->end()),
-      GTE = gep_type_end($2->get(), $4->begin(), $4->end());
+      GTI = gep_type_begin($2.type->get(), $4->begin(), $4->end()),
+      GTE = gep_type_end($2.type->get(), $4->begin(), $4->end());
     for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI)
       if (isa<StructType>(*GTI))        // Only change struct indices
         if (ConstantInt *CUI = dyn_cast<ConstantInt>((*$4)[i]))
           if (CUI->getType() == Type::UByteTy)
             (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
 
-    if (!GetElementPtrInst::getIndexedType(*$2, *$4, true))
+    if (!GetElementPtrInst::getIndexedType($2.type->get(), *$4, true))
       GEN_ERROR("Invalid getelementptr indices for type '" +
-                     (*$2)->getDescription()+ "'!");
-    Value* tmpVal = getVal(*$2, $3);
+                     $2.type->get()->getDescription()+ "'!");
+    Value* tmpVal = getVal($2.type->get(), $3);
     CHECK_FOR_ERROR
     $$ = new GetElementPtrInst(tmpVal, *$4);
-    delete $2; 
+    delete $2.type; 
     delete $4;
   };
 






More information about the llvm-commits mailing list