diff --git a/llvm/include/llvm/Bytecode/BytecodeHandler.h b/llvm/include/llvm/Bytecode/BytecodeHandler.h index a3e5bb7f1f33cca7f847575a2025f73a1ba975b3..c3ddc62030380b3f4792aa60b8e2d3dee6cee377 100644 --- a/llvm/include/llvm/Bytecode/BytecodeHandler.h +++ b/llvm/include/llvm/Bytecode/BytecodeHandler.h @@ -181,16 +181,14 @@ public: virtual void handleCompactionTableEnd() {} /// @brief Handle start of a symbol table - virtual void handleSymbolTableBegin( - Function* Func, ///< The function to which the ST belongs - SymbolTable* ST ///< The symbol table being filled + virtual void handleTypeSymbolTableBegin( + TypeSymbolTable* ST ///< The symbol table being filled ) {} - /// @brief Handle start of a symbol table plane - virtual void handleSymbolTablePlane( - unsigned TySlot, ///< The slotnum of the type plane - unsigned NumEntries, ///< Number of entries in the plane - const Type* Typ ///< The type of this type plane + /// @brief Handle start of a symbol table + virtual void handleValueSymbolTableBegin( + Function* Func, ///< The function to which the ST belongs or 0 for Mod + ValueSymbolTable* ST ///< The symbol table being filled ) {} /// @brief Handle a named type in the symbol table @@ -207,8 +205,11 @@ public: const std::string& name ///< Name of the value. ) {} - /// @brief Handle the end of a symbol table - virtual void handleSymbolTableEnd() {} + /// @brief Handle the end of a value symbol table + virtual void handleTypeSymbolTableEnd() {} + + /// @brief Handle the end of a type symbol table + virtual void handleValueSymbolTableEnd() {} /// @brief Handle the beginning of a function body virtual void handleFunctionBegin( @@ -233,6 +234,7 @@ public: unsigned Opcode, ///< Opcode of the instruction const Type* iType, ///< Instruction type std::vector& Operands, ///< Vector of slot # operands + Instruction *Inst, ///< The resulting instruction unsigned Length ///< Length of instruction in bc bytes ) { return false; } diff --git a/llvm/include/llvm/Function.h b/llvm/include/llvm/Function.h index f2a56ac17d97007a2429a733ffca80b0870f18cc..4cfb6761cce5fddf0ea2a4992e40019974bc8e36 100644 --- a/llvm/include/llvm/Function.h +++ b/llvm/include/llvm/Function.h @@ -63,7 +63,7 @@ private: BasicBlockListType BasicBlocks; // The basic blocks ArgumentListType ArgumentList; // The formal arguments - SymbolTable *SymTab; + ValueSymbolTable *SymTab; unsigned CallingConvention; friend class SymbolTableListTraits; @@ -156,8 +156,8 @@ public: /// getSymbolTable() - Return the symbol table... /// - inline SymbolTable &getValueSymbolTable() { return *SymTab; } - inline const SymbolTable &getValueSymbolTable() const { return *SymTab; } + inline ValueSymbolTable &getValueSymbolTable() { return *SymTab; } + inline const ValueSymbolTable &getValueSymbolTable() const { return *SymTab; } //===--------------------------------------------------------------------===// diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h index 01e049938d4c1bc73ba2c64482803a3189fa1d56..1b9322049e059c396ccf3c04fb511af031e96732 100644 --- a/llvm/include/llvm/LinkAllPasses.h +++ b/llvm/include/llvm/LinkAllPasses.h @@ -64,7 +64,6 @@ namespace { (void) llvm::createEmitFunctionTablePass(); (void) llvm::createFunctionInliningPass(); (void) llvm::createFunctionProfilerPass(); - (void) llvm::createFunctionResolvingPass(); (void) llvm::createGCSEPass(); (void) llvm::createGlobalDCEPass(); (void) llvm::createGlobalOptimizerPass(); diff --git a/llvm/include/llvm/Module.h b/llvm/include/llvm/Module.h index 7470debcda488c4133335cdc6d929d806ed92164..6992563abd975a8fd9508ea570b43f03184fb8b6 100644 --- a/llvm/include/llvm/Module.h +++ b/llvm/include/llvm/Module.h @@ -23,8 +23,6 @@ namespace llvm { class GlobalVariable; class GlobalValueRefMap; // Used by ConstantVals.cpp class FunctionType; -class SymbolTable; -class TypeSymbolTable; template<> struct ilist_traits : public SymbolTableListTraits { @@ -91,7 +89,7 @@ private: FunctionListType FunctionList; ///< The Functions in the module LibraryListType LibraryList; ///< The Libraries needed by the module std::string GlobalScopeAsm; ///< Inline Asm at global scope. - SymbolTable *ValSymTab; ///< Symbol table for values + ValueSymbolTable *ValSymTab; ///< Symbol table for values TypeSymbolTable *TypeSymTab; ///< Symbol table for types std::string ModuleID; ///< Human readable identifier for the module std::string TargetTriple; ///< Platform target triple Module compiled on @@ -178,17 +176,19 @@ public: /// getFunction - Look up the specified function in the module symbol table. /// If it does not exist, return null. - Function *getFunction(const std::string &Name, const FunctionType *Ty); + Function *getFunction(const std::string &Name) const; /// getMainFunction - This function looks up main efficiently. This is such a /// common case, that it is a method in Module. If main cannot be found, a /// null pointer is returned. - Function *getMainFunction(); + Function *getMainFunction() { return getFunction("main"); } /// getNamedFunction - Return the first function in the module with the /// specified name, of arbitrary type. This method returns null if a function /// with the specified name is not found. - Function *getNamedFunction(const std::string &Name) const; + Function *getNamedFunction(const std::string &Name) const { + return getFunction(Name); + } /// @} /// @name Global Variable Accessors @@ -200,13 +200,15 @@ public: /// the top-level PointerType, which represents the address of the global. /// If AllowInternal is set to true, this function will return types that /// have InternalLinkage. By default, these types are not returned. - GlobalVariable *getGlobalVariable(const std::string &Name, const Type *Ty, - bool AllowInternal = false); + GlobalVariable *getGlobalVariable(const std::string &Name, + bool AllowInternal = false) const; /// getNamedGlobal - Return the first global variable in the module with the /// specified name, of arbitrary type. This method returns null if a global /// with the specified name is not found. - GlobalVariable *getNamedGlobal(const std::string &Name) const; + GlobalVariable *getNamedGlobal(const std::string &Name) const { + return getGlobalVariable(Name, true); + } /// @} /// @name Type Accessors @@ -238,9 +240,9 @@ public: /// Get the Module's list of functions. FunctionListType &getFunctionList() { return FunctionList; } /// Get the symbol table of global variable and function identifiers - const SymbolTable &getValueSymbolTable() const { return *ValSymTab; } + const ValueSymbolTable &getValueSymbolTable() const { return *ValSymTab; } /// Get the Module's symbol table of global variable and function identifiers. - SymbolTable &getValueSymbolTable() { return *ValSymTab; } + ValueSymbolTable &getValueSymbolTable() { return *ValSymTab; } /// Get the symbol table of types const TypeSymbolTable &getTypeSymbolTable() const { return *TypeSymTab; } /// Get the Module's symbol table of types diff --git a/llvm/include/llvm/SymbolTable.h b/llvm/include/llvm/SymbolTable.h deleted file mode 100644 index 6451f9c8e22ec0c7bf603b11c2fd4cb9941b4140..0000000000000000000000000000000000000000 --- a/llvm/include/llvm/SymbolTable.h +++ /dev/null @@ -1,257 +0,0 @@ -//===-- llvm/SymbolTable.h - Implement a type plane'd symtab ----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and re-written by Reid -// Spencer. It is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the main symbol table for LLVM. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SYMBOL_TABLE_H -#define LLVM_SYMBOL_TABLE_H - -#include "llvm/Value.h" -#include "llvm/Support/DataTypes.h" -#include - -namespace llvm { - -/// This class provides a symbol table of name/value pairs that is broken -/// up by type. For each Type* there is a "plane" of name/value pairs in -/// the symbol table. Identical types may have overlapping symbol names as -/// long as they are distinct. The SymbolTable also tracks, separately, a -/// map of name/type pairs. This allows types to be named. Types are treated -/// distinctly from Values. -/// -/// The SymbolTable provides several utility functions for answering common -/// questions about its contents as well as an iterator interface for -/// directly iterating over the contents. To reduce confusion, the terms -/// "type", "value", and "plane" are used consistently. For example, -/// There is a TypeMap typedef that is the mapping of names to Types. -/// Similarly there is a ValueMap typedef that is the mapping of -/// names to Values. Finally, there is a PlaneMap typedef that is the -/// mapping of types to planes of ValueMap. This is the basic structure -/// of the symbol table. When you call type_begin() you're asking -/// for an iterator at the start of the TypeMap. When you call -/// plane_begin(), you're asking for an iterator at the start of -/// the PlaneMap. Finally, when you call value_begin(), you're asking -/// for an iterator at the start of a ValueMap for a specific type -/// plane. -class SymbolTable : public AbstractTypeUser { - -/// @name Types -/// @{ -public: - /// @brief A mapping of names to values. - typedef std::map ValueMap; - - /// @brief An iterator over a ValueMap. - typedef ValueMap::iterator value_iterator; - - /// @brief A const_iterator over a ValueMap. - typedef ValueMap::const_iterator value_const_iterator; - - /// @brief A mapping of types to names to values (type planes). - typedef std::map PlaneMap; - - /// @brief An iterator over the type planes. - typedef PlaneMap::iterator plane_iterator; - - /// @brief A const_iterator over the type planes - typedef PlaneMap::const_iterator plane_const_iterator; - -/// @} -/// @name Constructors -/// @{ -public: - - SymbolTable() : LastUnique(0) {} - ~SymbolTable(); - -/// @} -/// @name Accessors -/// @{ -public: - - /// This method finds the value with the given \p name in the - /// type plane \p Ty and returns it. This method will not find any - /// Types, only Values. Use lookupType to find Types by name. - /// @returns null on failure, otherwise the Value associated with - /// the \p name in type plane \p Ty. - /// @brief Lookup a named, typed value. - Value *lookup(const Type *Ty, const std::string &name) const; - - /// @returns true iff the type map and the type plane are both not - /// empty. - /// @brief Determine if the symbol table is empty - inline bool isEmpty() const { return pmap.empty(); } - - /// Given a base name, return a string that is either equal to it or - /// derived from it that does not already occur in the symbol table - /// for the specified type. - /// @brief Get a name unique to this symbol table - std::string getUniqueName(const Type *Ty, - const std::string &BaseName) const; - - /// This function can be used from the debugger to display the - /// content of the symbol table while debugging. - /// @brief Print out symbol table on stderr - void dump() const; - -/// @} -/// @name Iteration -/// @{ -public: - - /// Get an iterator that starts at the beginning of the type planes. - /// The iterator will iterate over the Type/ValueMap pairs in the - /// type planes. - inline plane_iterator plane_begin() { return pmap.begin(); } - - /// Get a const_iterator that starts at the beginning of the type - /// planes. The iterator will iterate over the Type/ValueMap pairs - /// in the type planes. - inline plane_const_iterator plane_begin() const { return pmap.begin(); } - - /// Get an iterator at the end of the type planes. This serves as - /// the marker for end of iteration over the type planes. - inline plane_iterator plane_end() { return pmap.end(); } - - /// Get a const_iterator at the end of the type planes. This serves as - /// the marker for end of iteration over the type planes. - inline plane_const_iterator plane_end() const { return pmap.end(); } - - /// Get an iterator that starts at the beginning of a type plane. - /// The iterator will iterate over the name/value pairs in the type plane. - /// @note The type plane must already exist before using this. - inline value_iterator value_begin(const Type *Typ) { - assert(Typ && "Can't get value iterator with null type!"); - return pmap.find(Typ)->second.begin(); - } - - /// Get a const_iterator that starts at the beginning of a type plane. - /// The iterator will iterate over the name/value pairs in the type plane. - /// @note The type plane must already exist before using this. - inline value_const_iterator value_begin(const Type *Typ) const { - assert(Typ && "Can't get value iterator with null type!"); - return pmap.find(Typ)->second.begin(); - } - - /// Get an iterator to the end of a type plane. This serves as the marker - /// for end of iteration of the type plane. - /// @note The type plane must already exist before using this. - inline value_iterator value_end(const Type *Typ) { - assert(Typ && "Can't get value iterator with null type!"); - return pmap.find(Typ)->second.end(); - } - - /// Get a const_iterator to the end of a type plane. This serves as the - /// marker for end of iteration of the type plane. - /// @note The type plane must already exist before using this. - inline value_const_iterator value_end(const Type *Typ) const { - assert(Typ && "Can't get value iterator with null type!"); - return pmap.find(Typ)->second.end(); - } - - /// This method returns a plane_const_iterator for iteration over - /// the type planes starting at a specific plane, given by \p Ty. - /// @brief Find a type plane. - inline plane_const_iterator find(const Type* Typ) const { - assert(Typ && "Can't find type plane with null type!"); - return pmap.find(Typ); - } - - /// This method returns a plane_iterator for iteration over the - /// type planes starting at a specific plane, given by \p Ty. - /// @brief Find a type plane. - inline plane_iterator find(const Type* Typ) { - assert(Typ && "Can't find type plane with null type!"); - return pmap.find(Typ); - } - - -/// @} -/// @name Mutators -/// @{ -public: - - /// This method will strip the symbol table of its names leaving the type and - /// values. - /// @brief Strip the symbol table. - bool strip(); - -/// @} -/// @name Mutators used by Value::setName and other LLVM internals. -/// @{ -public: - - /// This method adds the provided value \p N to the symbol table. The Value - /// must have both a name and a type which are extracted and used to place the - /// value in the correct type plane under the value's name. - /// @brief Add a named value to the symbol table - inline void insert(Value *Val) { - assert(Val && "Can't insert null type into symbol table!"); - assert(Val->hasName() && "Value must be named to go into symbol table!"); - insertEntry(Val->getName(), Val->getType(), Val); - } - - /// This method removes a named value from the symbol table. The type and name - /// of the Value are extracted from \p N and used to lookup the Value in the - /// correct type plane. If the Value is not in the symbol table, this method - /// silently ignores the request. - /// @brief Remove a named value from the symbol table. - void remove(Value* Val); - - /// changeName - Given a value with a non-empty name, remove its existing - /// entry from the symbol table and insert a new one for Name. This is - /// equivalent to doing "remove(V), V->Name = Name, insert(V)", but is faster, - /// and will not temporarily remove the symbol table plane if V is the last - /// value in the symtab with that name (which could invalidate iterators to - /// that plane). - void changeName(Value *V, const std::string &Name); - -/// @} -/// @name Internal Methods -/// @{ -private: - /// @brief Insert a value into the symbol table with the specified name. - void insertEntry(const std::string &Name, const Type *Ty, Value *V); - - /// This function is called when one of the types in the type plane - /// is refined. - virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy); - - /// This function markes a type as being concrete (defined). - virtual void typeBecameConcrete(const DerivedType *AbsTy); - -/// @} -/// @name Internal Data -/// @{ -private: - - /// This is the main content of the symbol table. It provides - /// separate type planes for named values. That is, each named - /// value is organized into a separate dictionary based on - /// Type. This means that the same name can be used for different - /// types without conflict. - /// @brief The mapping of types to names to values. - PlaneMap pmap; - - /// This value is used to retain the last unique value used - /// by getUniqueName to generate unique names. - mutable uint32_t LastUnique; -/// @} - -}; - -} // End llvm namespace - -// vim: sw=2 - -#endif - diff --git a/llvm/include/llvm/Transforms/IPO.h b/llvm/include/llvm/Transforms/IPO.h index b24857e967f14a0a5300f1917c69895e3a1dd99b..6ab6d7b9194ecf988dda5a456f1463b7b5da8f07 100644 --- a/llvm/include/llvm/Transforms/IPO.h +++ b/llvm/include/llvm/Transforms/IPO.h @@ -86,19 +86,6 @@ ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false, bool relinkCallees = false); -//===----------------------------------------------------------------------===// -/// FunctionResolvingPass - Go over the functions that are in the module and -/// look for functions that have the same name. More often than not, there will -/// be things like: -/// void "foo"(...) -/// void "foo"(int, int) -/// because of the way things are declared in C. If this is the case, patch -/// things up. -/// -/// This is an interprocedural pass. -/// -ModulePass *createFunctionResolvingPass(); - //===----------------------------------------------------------------------===// /// createFunctionInliningPass - Return a new pass object that uses a heuristic /// to inline direct function calls to small functions. @@ -163,20 +150,24 @@ FunctionPass *createLoopExtractorPass(); /// FunctionPass *createSingleLoopExtractorPass(); -// createBlockExtractorPass - This pass extracts all blocks (except those -// specified in the argument list) from the functions in the module. -// +/// createBlockExtractorPass - This pass extracts all blocks (except those +/// specified in the argument list) from the functions in the module. +/// ModulePass *createBlockExtractorPass(std::vector &BTNE); -// createOptimizeWellKnownCallsPass - This pass optimizes specific calls to -// specific well-known (library) functions. +/// createOptimizeWellKnownCallsPass - This pass optimizes specific calls to +/// specific well-known (library) functions. ModulePass *createSimplifyLibCallsPass(); -// createIndMemRemPass - This pass removes potential indirect calls of -// malloc and free +/// createIndMemRemPass - This pass removes potential indirect calls of +/// malloc and free ModulePass *createIndMemRemPass(); +/// createStripDeadPrototypesPass - This pass removes any function declarations +/// (prototypes) that are not used. +ModulePass *createStripDeadPrototypesPass(); + } // End llvm namespace #endif diff --git a/llvm/include/llvm/Value.h b/llvm/include/llvm/Value.h index e1d26bb42e057ea6ecda3750f0701845c7e3a0b6..63af0f747d6b64a1a78cf21afa1324394b00e259 100644 --- a/llvm/include/llvm/Value.h +++ b/llvm/include/llvm/Value.h @@ -31,7 +31,8 @@ class GlobalValue; class Function; class GlobalVariable; class InlineAsm; -class SymbolTable; +class ValueSymbolTable; +class TypeSymbolTable; //===----------------------------------------------------------------------===// // Value Class diff --git a/llvm/include/llvm/ValueSymbolTable.h b/llvm/include/llvm/ValueSymbolTable.h index 515e054d5c53dacfcec2d3cd4a3f1d866334d137..edc44901b5dc372b59c5fea7e270c0e3da1c3f15 100644 --- a/llvm/include/llvm/ValueSymbolTable.h +++ b/llvm/include/llvm/ValueSymbolTable.h @@ -72,6 +72,12 @@ public: /// @brief Get a name unique to this symbol table std::string getUniqueName(const std::string &BaseName) const; + /// @return 1 if the name is in the symbol table, 0 otherwise + /// @brief Determine if a name is in the symbol table + ValueMap::size_type count(const std::string &name) const { + return vmap.count(name); + } + /// This function can be used from the debugger to display the /// content of the symbol table while debugging. /// @brief Print out symbol table on stderr @@ -111,10 +117,10 @@ public: /// This method removes a value from the symbol table. The name of the /// Value is extracted from \p Val and used to lookup the Value in the /// symbol table. If the Value is not in the symbol table, this method - /// returns false. - /// @returns true if \p Val was successfully erased, false otherwise + /// returns false. \p Val is not deleted, just removed from the symbol table. + /// @returns true if \p Val was successfully removed, false otherwise /// @brief Remove a value from the symbol table. - bool erase(Value* Val); + bool remove(Value* Val); /// Given a value with a non-empty name, remove its existing /// entry from the symbol table and insert a new one for Name. This is diff --git a/llvm/lib/AsmParser/Lexer.cpp.cvs b/llvm/lib/AsmParser/Lexer.cpp.cvs index f2e3e13a92a8923b1efb877a18e3986797aa457b..9257cce3ee4d729bcf33f5adfc45c60831160c9e 100644 --- a/llvm/lib/AsmParser/Lexer.cpp.cvs +++ b/llvm/lib/AsmParser/Lexer.cpp.cvs @@ -869,7 +869,7 @@ goto find_rule; \ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 1 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" #define INITIAL 0 /*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===// // @@ -884,7 +884,7 @@ char *yytext; // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#line 28 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 28 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" #include "ParserInternals.h" #include "llvm/Module.h" #include @@ -1168,7 +1168,7 @@ YY_DECL register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 189 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 189 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" #line 1175 "Lexer.cpp" @@ -1264,252 +1264,252 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 191 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 191 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { /* Ignore comments for now */ } YY_BREAK case 2: YY_RULE_SETUP -#line 193 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 193 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return BEGINTOK; } YY_BREAK case 3: YY_RULE_SETUP -#line 194 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 194 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ENDTOK; } YY_BREAK case 4: YY_RULE_SETUP -#line 195 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 195 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TRUETOK; } YY_BREAK case 5: YY_RULE_SETUP -#line 196 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 196 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return FALSETOK; } YY_BREAK case 6: YY_RULE_SETUP -#line 197 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 197 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DECLARE; } YY_BREAK case 7: YY_RULE_SETUP -#line 198 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 198 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DEFINE; } YY_BREAK case 8: YY_RULE_SETUP -#line 199 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 199 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return GLOBAL; } YY_BREAK case 9: YY_RULE_SETUP -#line 200 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 200 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return CONSTANT; } YY_BREAK case 10: YY_RULE_SETUP -#line 201 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 201 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return INTERNAL; } YY_BREAK case 11: YY_RULE_SETUP -#line 202 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 202 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return LINKONCE; } YY_BREAK case 12: YY_RULE_SETUP -#line 203 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 203 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return WEAK; } YY_BREAK case 13: YY_RULE_SETUP -#line 204 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 204 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return APPENDING; } YY_BREAK case 14: YY_RULE_SETUP -#line 205 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 205 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DLLIMPORT; } YY_BREAK case 15: YY_RULE_SETUP -#line 206 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 206 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DLLEXPORT; } YY_BREAK case 16: YY_RULE_SETUP -#line 207 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 207 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return HIDDEN; } YY_BREAK case 17: YY_RULE_SETUP -#line 208 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 208 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return EXTERN_WEAK; } YY_BREAK case 18: YY_RULE_SETUP -#line 209 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 209 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return EXTERNAL; } YY_BREAK case 19: YY_RULE_SETUP -#line 210 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 210 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return IMPLEMENTATION; } YY_BREAK case 20: YY_RULE_SETUP -#line 211 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 211 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ZEROINITIALIZER; } YY_BREAK case 21: YY_RULE_SETUP -#line 212 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 212 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DOTDOTDOT; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 213 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UNDEF; } YY_BREAK case 23: YY_RULE_SETUP -#line 214 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 214 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return NULL_TOK; } YY_BREAK case 24: YY_RULE_SETUP -#line 215 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 215 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TO; } YY_BREAK case 25: YY_RULE_SETUP -#line 216 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 216 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TAIL; } YY_BREAK case 26: YY_RULE_SETUP -#line 217 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 217 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TARGET; } YY_BREAK case 27: YY_RULE_SETUP -#line 218 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 218 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TRIPLE; } YY_BREAK case 28: YY_RULE_SETUP -#line 219 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 219 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DEPLIBS; } YY_BREAK case 29: YY_RULE_SETUP -#line 220 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 220 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DATALAYOUT; } YY_BREAK case 30: YY_RULE_SETUP -#line 221 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 221 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return VOLATILE; } YY_BREAK case 31: YY_RULE_SETUP -#line 222 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 222 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ALIGN; } YY_BREAK case 32: YY_RULE_SETUP -#line 223 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 223 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SECTION; } YY_BREAK case 33: YY_RULE_SETUP -#line 224 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 224 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return MODULE; } YY_BREAK case 34: YY_RULE_SETUP -#line 225 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 225 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ASM_TOK; } YY_BREAK case 35: YY_RULE_SETUP -#line 226 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 226 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SIDEEFFECT; } YY_BREAK case 36: YY_RULE_SETUP -#line 228 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 228 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return CC_TOK; } YY_BREAK case 37: YY_RULE_SETUP -#line 229 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 229 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return CCC_TOK; } YY_BREAK case 38: YY_RULE_SETUP -#line 230 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 230 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return FASTCC_TOK; } YY_BREAK case 39: YY_RULE_SETUP -#line 231 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 231 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return COLDCC_TOK; } YY_BREAK case 40: YY_RULE_SETUP -#line 232 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 232 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return X86_STDCALLCC_TOK; } YY_BREAK case 41: YY_RULE_SETUP -#line 233 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 233 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return X86_FASTCALLCC_TOK; } YY_BREAK case 42: YY_RULE_SETUP -#line 235 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 235 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return INREG; } YY_BREAK case 43: YY_RULE_SETUP -#line 236 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 236 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SRET; } YY_BREAK case 44: YY_RULE_SETUP -#line 238 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 238 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::VoidTy, VOID); } YY_BREAK case 45: YY_RULE_SETUP -#line 239 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 239 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::FloatTy, FLOAT); } YY_BREAK case 46: YY_RULE_SETUP -#line 240 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 240 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::DoubleTy,DOUBLE);} YY_BREAK case 47: YY_RULE_SETUP -#line 241 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 241 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::LabelTy, LABEL); } YY_BREAK case 48: YY_RULE_SETUP -#line 242 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 242 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TYPE; } YY_BREAK case 49: YY_RULE_SETUP -#line 243 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 243 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OPAQUE; } YY_BREAK case 50: YY_RULE_SETUP -#line 244 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 244 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { uint64_t NumBits = atoull(yytext+1); if (NumBits < IntegerType::MIN_INT_BITS || NumBits > IntegerType::MAX_INT_BITS) @@ -1520,347 +1520,347 @@ YY_RULE_SETUP YY_BREAK case 51: YY_RULE_SETUP -#line 252 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 252 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Add, ADD); } YY_BREAK case 52: YY_RULE_SETUP -#line 253 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 253 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Sub, SUB); } YY_BREAK case 53: YY_RULE_SETUP -#line 254 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 254 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Mul, MUL); } YY_BREAK case 54: YY_RULE_SETUP -#line 255 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 255 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, UDiv, UDIV); } YY_BREAK case 55: YY_RULE_SETUP -#line 256 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 256 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SDiv, SDIV); } YY_BREAK case 56: YY_RULE_SETUP -#line 257 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 257 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FDiv, FDIV); } YY_BREAK case 57: YY_RULE_SETUP -#line 258 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 258 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, URem, UREM); } YY_BREAK case 58: YY_RULE_SETUP -#line 259 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 259 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SRem, SREM); } YY_BREAK case 59: YY_RULE_SETUP -#line 260 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 260 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FRem, FREM); } YY_BREAK case 60: YY_RULE_SETUP -#line 261 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 261 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Shl, SHL); } YY_BREAK case 61: YY_RULE_SETUP -#line 262 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 262 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, LShr, LSHR); } YY_BREAK case 62: YY_RULE_SETUP -#line 263 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 263 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, AShr, ASHR); } YY_BREAK case 63: YY_RULE_SETUP -#line 264 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 264 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, And, AND); } YY_BREAK case 64: YY_RULE_SETUP -#line 265 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 265 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Or , OR ); } YY_BREAK case 65: YY_RULE_SETUP -#line 266 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 266 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Xor, XOR); } YY_BREAK case 66: YY_RULE_SETUP -#line 267 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 267 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ICmp, ICMP); } YY_BREAK case 67: YY_RULE_SETUP -#line 268 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 268 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, FCmp, FCMP); } YY_BREAK case 68: YY_RULE_SETUP -#line 270 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 270 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return EQ; } YY_BREAK case 69: YY_RULE_SETUP -#line 271 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 271 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return NE; } YY_BREAK case 70: YY_RULE_SETUP -#line 272 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 272 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SLT; } YY_BREAK case 71: YY_RULE_SETUP -#line 273 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 273 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SGT; } YY_BREAK case 72: YY_RULE_SETUP -#line 274 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 274 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SLE; } YY_BREAK case 73: YY_RULE_SETUP -#line 275 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 275 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SGE; } YY_BREAK case 74: YY_RULE_SETUP -#line 276 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 276 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ULT; } YY_BREAK case 75: YY_RULE_SETUP -#line 277 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 277 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UGT; } YY_BREAK case 76: YY_RULE_SETUP -#line 278 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 278 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ULE; } YY_BREAK case 77: YY_RULE_SETUP -#line 279 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 279 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UGE; } YY_BREAK case 78: YY_RULE_SETUP -#line 280 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 280 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OEQ; } YY_BREAK case 79: YY_RULE_SETUP -#line 281 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 281 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ONE; } YY_BREAK case 80: YY_RULE_SETUP -#line 282 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 282 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OLT; } YY_BREAK case 81: YY_RULE_SETUP -#line 283 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 283 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OGT; } YY_BREAK case 82: YY_RULE_SETUP -#line 284 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 284 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OLE; } YY_BREAK case 83: YY_RULE_SETUP -#line 285 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 285 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OGE; } YY_BREAK case 84: YY_RULE_SETUP -#line 286 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 286 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ORD; } YY_BREAK case 85: YY_RULE_SETUP -#line 287 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 287 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UNO; } YY_BREAK case 86: YY_RULE_SETUP -#line 288 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 288 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UEQ; } YY_BREAK case 87: YY_RULE_SETUP -#line 289 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 289 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UNE; } YY_BREAK case 88: YY_RULE_SETUP -#line 291 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 291 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, PHI, PHI_TOK); } YY_BREAK case 89: YY_RULE_SETUP -#line 292 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 292 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Call, CALL); } YY_BREAK case 90: YY_RULE_SETUP -#line 293 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 293 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, Trunc, TRUNC); } YY_BREAK case 91: YY_RULE_SETUP -#line 294 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 294 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, ZExt, ZEXT); } YY_BREAK case 92: YY_RULE_SETUP -#line 295 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 295 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, SExt, SEXT); } YY_BREAK case 93: YY_RULE_SETUP -#line 296 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 296 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPTrunc, FPTRUNC); } YY_BREAK case 94: YY_RULE_SETUP -#line 297 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 297 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPExt, FPEXT); } YY_BREAK case 95: YY_RULE_SETUP -#line 298 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 298 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, UIToFP, UITOFP); } YY_BREAK case 96: YY_RULE_SETUP -#line 299 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 299 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, SIToFP, SITOFP); } YY_BREAK case 97: YY_RULE_SETUP -#line 300 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 300 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPToUI, FPTOUI); } YY_BREAK case 98: YY_RULE_SETUP -#line 301 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 301 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPToSI, FPTOSI); } YY_BREAK case 99: YY_RULE_SETUP -#line 302 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 302 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, IntToPtr, INTTOPTR); } YY_BREAK case 100: YY_RULE_SETUP -#line 303 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 303 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, PtrToInt, PTRTOINT); } YY_BREAK case 101: YY_RULE_SETUP -#line 304 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 304 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, BitCast, BITCAST); } YY_BREAK case 102: YY_RULE_SETUP -#line 305 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 305 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Select, SELECT); } YY_BREAK case 103: YY_RULE_SETUP -#line 306 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 306 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, VAArg , VAARG); } YY_BREAK case 104: YY_RULE_SETUP -#line 307 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 307 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Ret, RET); } YY_BREAK case 105: YY_RULE_SETUP -#line 308 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 308 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Br, BR); } YY_BREAK case 106: YY_RULE_SETUP -#line 309 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 309 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Switch, SWITCH); } YY_BREAK case 107: YY_RULE_SETUP -#line 310 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 310 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Invoke, INVOKE); } YY_BREAK case 108: YY_RULE_SETUP -#line 311 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 311 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK case 109: YY_RULE_SETUP -#line 312 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 312 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unreachable, UNREACHABLE); } YY_BREAK case 110: YY_RULE_SETUP -#line 314 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 314 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Malloc, MALLOC); } YY_BREAK case 111: YY_RULE_SETUP -#line 315 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 315 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Alloca, ALLOCA); } YY_BREAK case 112: YY_RULE_SETUP -#line 316 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 316 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Free, FREE); } YY_BREAK case 113: YY_RULE_SETUP -#line 317 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 317 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Load, LOAD); } YY_BREAK case 114: YY_RULE_SETUP -#line 318 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 318 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Store, STORE); } YY_BREAK case 115: YY_RULE_SETUP -#line 319 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 319 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } YY_BREAK case 116: YY_RULE_SETUP -#line 321 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 321 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } YY_BREAK case 117: YY_RULE_SETUP -#line 322 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 322 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } YY_BREAK case 118: YY_RULE_SETUP -#line 323 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 323 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); } YY_BREAK case 119: YY_RULE_SETUP -#line 326 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 326 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { UnEscapeLexed(yytext+1); llvmAsmlval.StrVal = strdup(yytext+1); // Skip % @@ -1869,7 +1869,7 @@ YY_RULE_SETUP YY_BREAK case 120: YY_RULE_SETUP -#line 331 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 331 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { UnEscapeLexed(yytext+1); llvmAsmlval.StrVal = strdup(yytext+1); // Skip @ @@ -1878,7 +1878,7 @@ YY_RULE_SETUP YY_BREAK case 121: YY_RULE_SETUP -#line 336 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 336 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke colon UnEscapeLexed(yytext); @@ -1888,7 +1888,7 @@ YY_RULE_SETUP YY_BREAK case 122: YY_RULE_SETUP -#line 342 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 342 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-2] = 0; // nuke colon, end quote UnEscapeLexed(yytext+1); @@ -1898,7 +1898,7 @@ YY_RULE_SETUP YY_BREAK case 123: YY_RULE_SETUP -#line 349 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 349 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { // Note that we cannot unescape a string constant here! The // string constant might contain a \00 which would not be // understood by the string stuff. It is valid to make a @@ -1911,7 +1911,7 @@ YY_RULE_SETUP YY_BREAK case 124: YY_RULE_SETUP -#line 358 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 358 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke end quote llvmAsmlval.StrVal = strdup(yytext+2); // Nuke @, quote @@ -1920,12 +1920,12 @@ YY_RULE_SETUP YY_BREAK case 125: YY_RULE_SETUP -#line 366 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 366 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } YY_BREAK case 126: YY_RULE_SETUP -#line 367 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 367 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); // +1: we have bigger negative range @@ -1937,7 +1937,7 @@ YY_RULE_SETUP YY_BREAK case 127: YY_RULE_SETUP -#line 375 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 375 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = HexIntToVal(yytext+3); return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; @@ -1945,7 +1945,7 @@ YY_RULE_SETUP YY_BREAK case 128: YY_RULE_SETUP -#line 380 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 380 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); if ((unsigned)Val != Val) @@ -1956,7 +1956,7 @@ YY_RULE_SETUP YY_BREAK case 129: YY_RULE_SETUP -#line 387 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 387 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); if ((unsigned)Val != Val) @@ -1967,16 +1967,16 @@ YY_RULE_SETUP YY_BREAK case 130: YY_RULE_SETUP -#line 395 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 395 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = atof(yytext); return FPVAL; } YY_BREAK case 131: YY_RULE_SETUP -#line 396 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 396 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; } YY_BREAK case YY_STATE_EOF(INITIAL): -#line 398 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 398 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { /* Make sure to free the internal buffers for flex when we are * done reading our input! @@ -1987,17 +1987,17 @@ case YY_STATE_EOF(INITIAL): YY_BREAK case 132: YY_RULE_SETUP -#line 406 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 406 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { /* Ignore whitespace */ } YY_BREAK case 133: YY_RULE_SETUP -#line 407 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 407 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return yytext[0]; } YY_BREAK case 134: YY_RULE_SETUP -#line 409 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 409 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 2004 "Lexer.cpp" @@ -2878,5 +2878,5 @@ int main() return 0; } #endif -#line 409 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 409 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" diff --git a/llvm/lib/AsmParser/llvmAsmParser.cpp.cvs b/llvm/lib/AsmParser/llvmAsmParser.cpp.cvs index 02abfbb1f218d1e5ab5601facbfb6dd4d1bd85e3..b34c534eaa912d893ae6c7b9a50828401fcf64d8 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.cpp.cvs +++ b/llvm/lib/AsmParser/llvmAsmParser.cpp.cvs @@ -330,14 +330,14 @@ /* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 14 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/CommandLine.h" #include "llvm/ADT/SmallVector.h" @@ -529,7 +529,7 @@ static struct PerFunctionInfo { std::map Values; // Keep track of #'d definitions std::map LateResolveValues; - bool isDeclare; // Is this function a forward declararation? + bool isDeclare; // Is this function a forward declararation? GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. GlobalValue::VisibilityTypes Visibility; @@ -661,24 +661,33 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { // Module constants occupy the lowest numbered slots... std::map::iterator VI = CurModule.Values.find(Ty); - if (VI == CurModule.Values.end()) return 0; - if (D.Num >= VI->second.size()) return 0; + if (VI == CurModule.Values.end()) + return 0; + if (D.Num >= VI->second.size()) + return 0; return VI->second[Num]; } case ValID::LocalName: { // Is it a named definition? - if (!inFunctionScope()) return 0; - SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); - Value *N = SymTab.lookup(Ty, D.Name); - if (N == 0) return 0; + if (!inFunctionScope()) + return 0; + ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); + Value *N = SymTab.lookup(D.Name); + if (N == 0) + return 0; + if (N->getType() != Ty) + return 0; D.destroy(); // Free old strdup'd memory... return N; } case ValID::GlobalName: { // Is it a named definition? - SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); - Value *N = SymTab.lookup(Ty, D.Name); - if (N == 0) return 0; + ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); + Value *N = SymTab.lookup(D.Name); + if (N == 0) + return 0; + if (N->getType() != Ty) + return 0; D.destroy(); // Free old strdup'd memory... return N; @@ -819,8 +828,8 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { break; case ValID::LocalName: // Is it a named definition? Name = ID.Name; - if (Value *N = CurFun.CurrentFunction-> - getValueSymbolTable().lookup(Type::LabelTy, Name)) + Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); + if (N && N->getType()->getTypeID() == Type::LabelTyID) BB = cast(N); break; } @@ -960,8 +969,8 @@ static void setValueName(Value *V, char *NameStr) { } assert(inFunctionScope() && "Must be in function scope!"); - SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); - if (ST.lookup(V->getType(), Name)) { + ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); + if (ST.lookup(Name)) { GenerateError("Redefinition of value '" + Name + "' of type '" + V->getType()->getDescription() + "'"); return; @@ -1015,16 +1024,21 @@ ParseGlobalVariable(char *NameStr, return GV; } - // If this global has a name, check to see if there is already a definition - // of this global in the module. If so, it is an error. + // If this global has a name if (!Name.empty()) { - // We are a simple redefinition of a value, check to see if it is defined - // the same as the old one. - if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { - GenerateError("Redefinition of global variable named '" + Name + - "' of type '" + Ty->getDescription() + "'"); - return 0; - } + // if the global we're parsing has an initializer (is a definition) and + // has external linkage. + if (Initializer && Linkage != GlobalValue::InternalLinkage) + // If there is already a global with external linkage with this name + if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { + // If we allow this GVar to get created, it will be renamed in the + // symbol table because it conflicts with an existing GVar. We can't + // allow redefinition of GVars whose linking indicates that their name + // must stay the same. Issue the error. + GenerateError("Redefinition of global variable named '" + Name + + "' of type '" + Ty->getDescription() + "'"); + return 0; + } } // Otherwise there is no existing GV to use, create one now. @@ -1222,7 +1236,7 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 886 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 900 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1269,7 +1283,7 @@ typedef union YYSTYPE { llvm::FCmpInst::Predicate FPredicate; } YYSTYPE; /* Line 196 of yacc.c. */ -#line 1273 "llvmAsmParser.tab.c" +#line 1287 "llvmAsmParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1281,7 +1295,7 @@ typedef union YYSTYPE { /* Line 219 of yacc.c. */ -#line 1285 "llvmAsmParser.tab.c" +#line 1299 "llvmAsmParser.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -1629,35 +1643,35 @@ static const short int yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, - 1033, 1034, 1034, 1034, 1034, 1034, 1034, 1035, 1035, 1035, - 1035, 1035, 1035, 1036, 1036, 1036, 1036, 1036, 1036, 1039, - 1039, 1040, 1040, 1041, 1041, 1042, 1042, 1043, 1043, 1047, - 1047, 1048, 1048, 1049, 1049, 1050, 1050, 1051, 1051, 1052, - 1052, 1053, 1053, 1054, 1055, 1060, 1061, 1061, 1063, 1063, - 1064, 1064, 1068, 1072, 1077, 1077, 1079, 1083, 1089, 1090, - 1091, 1092, 1093, 1097, 1098, 1099, 1103, 1104, 1108, 1109, - 1110, 1114, 1115, 1116, 1117, 1118, 1121, 1122, 1123, 1124, - 1125, 1126, 1127, 1134, 1135, 1136, 1137, 1140, 1141, 1146, - 1147, 1150, 1151, 1158, 1159, 1165, 1166, 1174, 1182, 1183, - 1188, 1189, 1190, 1195, 1208, 1208, 1208, 1208, 1211, 1215, - 1219, 1226, 1231, 1239, 1257, 1275, 1280, 1292, 1302, 1306, - 1316, 1323, 1330, 1337, 1342, 1347, 1354, 1355, 1362, 1369, - 1377, 1382, 1393, 1421, 1437, 1466, 1494, 1519, 1538, 1563, - 1582, 1594, 1601, 1667, 1677, 1687, 1693, 1699, 1704, 1709, - 1717, 1729, 1750, 1758, 1764, 1775, 1780, 1785, 1791, 1797, - 1806, 1810, 1818, 1818, 1829, 1834, 1842, 1843, 1847, 1847, - 1851, 1851, 1854, 1857, 1869, 1893, 1904, 1904, 1914, 1914, - 1922, 1922, 1932, 1935, 1941, 1954, 1958, 1963, 1965, 1970, - 1975, 1984, 1994, 2005, 2009, 2018, 2027, 2032, 2138, 2138, - 2140, 2149, 2149, 2151, 2156, 2168, 2172, 2177, 2181, 2185, - 2189, 2193, 2197, 2201, 2205, 2209, 2234, 2238, 2252, 2256, - 2260, 2264, 2270, 2270, 2276, 2285, 2289, 2298, 2309, 2318, - 2330, 2343, 2347, 2351, 2356, 2366, 2385, 2394, 2461, 2465, - 2472, 2483, 2496, 2505, 2516, 2526, 2534, 2542, 2545, 2546, - 2553, 2557, 2562, 2583, 2600, 2613, 2626, 2638, 2646, 2653, - 2659, 2665, 2671, 2686, 2750, 2755, 2759, 2766, 2773, 2781, - 2788, 2796, 2804, 2818, 2835 + 0, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, + 1047, 1048, 1048, 1048, 1048, 1048, 1048, 1049, 1049, 1049, + 1049, 1049, 1049, 1050, 1050, 1050, 1050, 1050, 1050, 1053, + 1053, 1054, 1054, 1055, 1055, 1056, 1056, 1057, 1057, 1061, + 1061, 1062, 1062, 1063, 1063, 1064, 1064, 1065, 1065, 1066, + 1066, 1067, 1067, 1068, 1069, 1074, 1075, 1075, 1077, 1077, + 1078, 1078, 1082, 1086, 1091, 1091, 1093, 1097, 1103, 1104, + 1105, 1106, 1107, 1111, 1112, 1113, 1117, 1118, 1122, 1123, + 1124, 1128, 1129, 1130, 1131, 1132, 1135, 1136, 1137, 1138, + 1139, 1140, 1141, 1148, 1149, 1150, 1151, 1154, 1155, 1160, + 1161, 1164, 1165, 1172, 1173, 1179, 1180, 1188, 1196, 1197, + 1202, 1203, 1204, 1209, 1222, 1222, 1222, 1222, 1225, 1229, + 1233, 1240, 1245, 1253, 1271, 1289, 1294, 1306, 1316, 1320, + 1330, 1337, 1344, 1351, 1356, 1361, 1368, 1369, 1376, 1383, + 1391, 1396, 1407, 1435, 1451, 1480, 1508, 1533, 1552, 1577, + 1596, 1608, 1615, 1681, 1691, 1701, 1707, 1713, 1718, 1723, + 1731, 1743, 1764, 1772, 1778, 1789, 1794, 1799, 1805, 1811, + 1820, 1824, 1832, 1832, 1843, 1848, 1856, 1857, 1861, 1861, + 1865, 1865, 1868, 1871, 1883, 1907, 1918, 1918, 1928, 1928, + 1936, 1936, 1946, 1949, 1955, 1968, 1972, 1977, 1979, 1984, + 1989, 1998, 2008, 2019, 2023, 2032, 2041, 2046, 2158, 2158, + 2160, 2169, 2169, 2171, 2176, 2188, 2192, 2197, 2201, 2205, + 2209, 2213, 2217, 2221, 2225, 2229, 2254, 2258, 2272, 2276, + 2280, 2284, 2290, 2290, 2296, 2305, 2309, 2318, 2328, 2337, + 2349, 2362, 2366, 2370, 2375, 2385, 2404, 2413, 2480, 2484, + 2491, 2502, 2515, 2525, 2536, 2546, 2554, 2562, 2565, 2566, + 2573, 2577, 2582, 2603, 2620, 2633, 2646, 2658, 2666, 2673, + 2679, 2685, 2691, 2706, 2770, 2775, 2779, 2786, 2793, 2801, + 2808, 2816, 2824, 2838, 2855 }; #endif @@ -2981,142 +2995,142 @@ yyreduce: switch (yyn) { case 29: -#line 1039 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} break; case 30: -#line 1039 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} break; case 31: -#line 1040 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} break; case 32: -#line 1040 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} break; case 33: -#line 1041 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} break; case 34: -#line 1041 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} break; case 35: -#line 1042 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} break; case 36: -#line 1042 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} break; case 37: -#line 1043 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1057 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} break; case 38: -#line 1043 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1057 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} break; case 39: -#line 1047 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} break; case 40: -#line 1047 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} break; case 41: -#line 1048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} break; case 42: -#line 1048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} break; case 43: -#line 1049 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} break; case 44: -#line 1049 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} break; case 45: -#line 1050 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} break; case 46: -#line 1050 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} break; case 47: -#line 1051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} break; case 48: -#line 1051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} break; case 49: -#line 1052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} break; case 50: -#line 1052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} break; case 51: -#line 1053 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} break; case 52: -#line 1053 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} break; case 53: -#line 1054 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1068 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} break; case 54: -#line 1055 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1069 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} break; case 61: -#line 1064 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1078 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 62: -#line 1068 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1082 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[-1].StrVal); CHECK_FOR_ERROR @@ -3124,7 +3138,7 @@ yyreduce: break; case 63: -#line 1072 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1086 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3132,7 +3146,7 @@ yyreduce: break; case 66: -#line 1079 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1093 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[-1].StrVal); CHECK_FOR_ERROR @@ -3140,7 +3154,7 @@ yyreduce: break; case 67: -#line 1083 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1097 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3148,127 +3162,127 @@ yyreduce: break; case 68: -#line 1089 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1103 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 69: -#line 1090 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1104 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 70: -#line 1091 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1105 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 71: -#line 1092 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1106 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 72: -#line 1093 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1107 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 73: -#line 1097 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1111 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 74: -#line 1098 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1112 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 75: -#line 1099 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1113 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 76: -#line 1103 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 77: -#line 1104 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1118 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} break; case 78: -#line 1108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1122 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 79: -#line 1109 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1123 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 80: -#line 1110 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1124 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 81: -#line 1114 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1128 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 82: -#line 1115 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1129 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 83: -#line 1116 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1130 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 84: -#line 1117 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1131 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 85: -#line 1118 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 86: -#line 1121 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1135 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 87: -#line 1122 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1136 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 88: -#line 1123 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1137 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 89: -#line 1124 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1138 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 90: -#line 1125 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1139 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 91: -#line 1126 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1140 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 92: -#line 1127 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1141 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) GEN_ERROR("Calling conv too large"); @@ -3278,61 +3292,61 @@ yyreduce: break; case 93: -#line 1134 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1148 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;} break; case 94: -#line 1135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1149 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;} break; case 95: -#line 1136 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;} break; case 96: -#line 1137 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1151 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;} break; case 97: -#line 1140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1154 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} break; case 98: -#line 1141 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1155 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); ;} break; case 99: -#line 1146 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1160 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;} break; case 101: -#line 1150 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1164 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} break; case 102: -#line 1151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1165 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); ;} break; case 103: -#line 1158 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1172 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 104: -#line 1159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1173 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3342,12 +3356,12 @@ yyreduce: break; case 105: -#line 1165 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1179 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 106: -#line 1166 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1180 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3357,7 +3371,7 @@ yyreduce: break; case 107: -#line 1174 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1188 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') @@ -3368,27 +3382,27 @@ yyreduce: break; case 108: -#line 1182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1196 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 109: -#line 1183 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1197 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[0].StrVal); ;} break; case 110: -#line 1188 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1202 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" {;} break; case 111: -#line 1189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1203 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" {;} break; case 112: -#line 1190 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1204 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -3397,7 +3411,7 @@ yyreduce: break; case 113: -#line 1195 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1209 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) GEN_ERROR("Alignment must be a power of two"); @@ -3407,7 +3421,7 @@ yyreduce: break; case 118: -#line 1211 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1225 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR @@ -3415,7 +3429,7 @@ yyreduce: break; case 119: -#line 1215 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1229 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); CHECK_FOR_ERROR @@ -3423,7 +3437,7 @@ yyreduce: break; case 120: -#line 1219 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1233 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[-1].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -3434,7 +3448,7 @@ yyreduce: break; case 121: -#line 1226 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1240 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR @@ -3443,7 +3457,7 @@ yyreduce: break; case 122: -#line 1231 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -3455,7 +3469,7 @@ yyreduce: break; case 123: -#line 1239 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1253 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { std::vector Params; std::vector Attrs; @@ -3477,7 +3491,7 @@ yyreduce: break; case 124: -#line 1257 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1271 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { std::vector Params; std::vector Attrs; @@ -3498,7 +3512,7 @@ yyreduce: break; case 125: -#line 1275 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1289 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); delete (yyvsp[-1].TypeVal); @@ -3507,7 +3521,7 @@ yyreduce: break; case 126: -#line 1280 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1294 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Packed array type? const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) @@ -3523,7 +3537,7 @@ yyreduce: break; case 127: -#line 1292 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1306 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -3537,7 +3551,7 @@ yyreduce: break; case 128: -#line 1302 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1316 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR @@ -3545,7 +3559,7 @@ yyreduce: break; case 129: -#line 1306 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1320 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = (yyvsp[-2].TypeList)->begin(), @@ -3559,7 +3573,7 @@ yyreduce: break; case 130: -#line 1316 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1330 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR @@ -3567,7 +3581,7 @@ yyreduce: break; case 131: -#line 1323 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1337 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal); (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); @@ -3575,7 +3589,7 @@ yyreduce: break; case 132: -#line 1330 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1344 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); @@ -3586,14 +3600,14 @@ yyreduce: break; case 133: -#line 1337 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1351 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); ;} break; case 134: -#line 1342 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1356 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs)); @@ -3602,7 +3616,7 @@ yyreduce: break; case 135: -#line 1347 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1361 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs)); CHECK_FOR_ERROR @@ -3610,7 +3624,7 @@ yyreduce: break; case 137: -#line 1355 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1369 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList); TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; @@ -3621,7 +3635,7 @@ yyreduce: break; case 138: -#line 1362 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1376 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; @@ -3632,7 +3646,7 @@ yyreduce: break; case 139: -#line 1369 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1383 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); CHECK_FOR_ERROR @@ -3640,7 +3654,7 @@ yyreduce: break; case 140: -#line 1377 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1391 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); @@ -3649,7 +3663,7 @@ yyreduce: break; case 141: -#line 1382 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1396 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR @@ -3657,7 +3671,7 @@ yyreduce: break; case 142: -#line 1393 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1407 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); @@ -3689,7 +3703,7 @@ yyreduce: break; case 143: -#line 1421 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1435 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); @@ -3709,7 +3723,7 @@ yyreduce: break; case 144: -#line 1437 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1451 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); @@ -3742,7 +3756,7 @@ yyreduce: break; case 145: -#line 1466 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1480 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); @@ -3774,7 +3788,7 @@ yyreduce: break; case 146: -#line 1494 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1508 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (STy == 0) @@ -3803,7 +3817,7 @@ yyreduce: break; case 147: -#line 1519 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1533 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); @@ -3826,7 +3840,7 @@ yyreduce: break; case 148: -#line 1538 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1552 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[-5].TypeVal)->get()); if (STy == 0) @@ -3855,7 +3869,7 @@ yyreduce: break; case 149: -#line 1563 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1577 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); @@ -3878,7 +3892,7 @@ yyreduce: break; case 150: -#line 1582 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1596 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -3894,7 +3908,7 @@ yyreduce: break; case 151: -#line 1594 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1608 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -3905,7 +3919,7 @@ yyreduce: break; case 152: -#line 1601 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1615 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -3975,7 +3989,7 @@ yyreduce: break; case 153: -#line 1667 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1681 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -3989,7 +4003,7 @@ yyreduce: break; case 154: -#line 1677 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1691 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -4003,7 +4017,7 @@ yyreduce: break; case 155: -#line 1687 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1701 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4013,7 +4027,7 @@ yyreduce: break; case 156: -#line 1693 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1707 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4023,7 +4037,7 @@ yyreduce: break; case 157: -#line 1699 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1713 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); (yyval.ConstVal) = ConstantInt::getTrue(); @@ -4032,7 +4046,7 @@ yyreduce: break; case 158: -#line 1704 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1718 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); (yyval.ConstVal) = ConstantInt::getFalse(); @@ -4041,7 +4055,7 @@ yyreduce: break; case 159: -#line 1709 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1723 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Float & Double constants if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) GEN_ERROR("Floating point constant invalid for type"); @@ -4051,7 +4065,7 @@ yyreduce: break; case 160: -#line 1717 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1731 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -4067,7 +4081,7 @@ yyreduce: break; case 161: -#line 1729 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1743 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-2].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -4092,7 +4106,7 @@ yyreduce: break; case 162: -#line 1750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1764 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -4104,7 +4118,7 @@ yyreduce: break; case 163: -#line 1758 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1772 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Binary operator types must match"); @@ -4114,7 +4128,7 @@ yyreduce: break; case 164: -#line 1764 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1778 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Logical operator types must match"); @@ -4129,7 +4143,7 @@ yyreduce: break; case 165: -#line 1775 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1789 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("icmp operand types must match"); @@ -4138,7 +4152,7 @@ yyreduce: break; case 166: -#line 1780 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1794 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match"); @@ -4147,7 +4161,7 @@ yyreduce: break; case 167: -#line 1785 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1799 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid extractelement operands"); @@ -4157,7 +4171,7 @@ yyreduce: break; case 168: -#line 1791 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1805 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid insertelement operands"); @@ -4167,7 +4181,7 @@ yyreduce: break; case 169: -#line 1797 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1811 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -4177,7 +4191,7 @@ yyreduce: break; case 170: -#line 1806 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1820 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR @@ -4185,7 +4199,7 @@ yyreduce: break; case 171: -#line 1810 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1824 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); @@ -4194,17 +4208,17 @@ yyreduce: break; case 172: -#line 1818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1832 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 173: -#line 1818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1832 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 174: -#line 1829 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1843 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -4213,7 +4227,7 @@ yyreduce: break; case 175: -#line 1834 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1848 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -4222,12 +4236,12 @@ yyreduce: break; case 178: -#line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1861 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ;} break; case 179: -#line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1861 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR @@ -4235,26 +4249,26 @@ yyreduce: break; case 180: -#line 1851 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1865 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 181: -#line 1851 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1865 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 182: -#line 1854 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1868 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 183: -#line 1857 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1871 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Emit an error if there are any unresolved types left. if (!CurModule.LateResolveTypes.empty()) { @@ -4270,7 +4284,7 @@ yyreduce: break; case 184: -#line 1869 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1883 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); @@ -4298,7 +4312,7 @@ yyreduce: break; case 185: -#line 1893 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1907 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType)); @@ -4313,7 +4327,7 @@ yyreduce: break; case 186: -#line 1904 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1918 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if ((yyvsp[0].ConstVal) == 0) @@ -4325,14 +4339,14 @@ yyreduce: break; case 187: -#line 1911 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1925 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 188: -#line 1914 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1928 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -4342,14 +4356,14 @@ yyreduce: break; case 189: -#line 1919 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1933 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 190: -#line 1922 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1936 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); @@ -4360,7 +4374,7 @@ yyreduce: break; case 191: -#line 1928 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1942 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4368,21 +4382,21 @@ yyreduce: break; case 192: -#line 1932 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1946 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 193: -#line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1949 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 194: -#line 1941 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1955 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); @@ -4398,7 +4412,7 @@ yyreduce: break; case 195: -#line 1954 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1968 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4406,7 +4420,7 @@ yyreduce: break; case 196: -#line 1958 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1972 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4414,7 +4428,7 @@ yyreduce: break; case 198: -#line 1965 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1979 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4423,7 +4437,7 @@ yyreduce: break; case 199: -#line 1970 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1984 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4432,14 +4446,14 @@ yyreduce: break; case 200: -#line 1975 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1989 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 201: -#line 1984 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 1998 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); @@ -4453,7 +4467,7 @@ yyreduce: break; case 202: -#line 1994 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); @@ -4467,7 +4481,7 @@ yyreduce: break; case 203: -#line 2005 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2019 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[0].ArgList); CHECK_FOR_ERROR @@ -4475,7 +4489,7 @@ yyreduce: break; case 204: -#line 2009 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2023 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); struct ArgListEntry E; @@ -4488,7 +4502,7 @@ yyreduce: break; case 205: -#line 2018 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2032 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new ArgListType; struct ArgListEntry E; @@ -4501,7 +4515,7 @@ yyreduce: break; case 206: -#line 2027 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2041 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -4509,7 +4523,7 @@ yyreduce: break; case 207: -#line 2033 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2047 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { UnEscapeLexed((yyvsp[-6].StrVal)); std::string FunctionName((yyvsp[-6].StrVal)); @@ -4558,17 +4572,21 @@ yyreduce: CurModule.CurrentModule->getFunctionList().remove(Fn); CurModule.CurrentModule->getFunctionList().push_back(Fn); } else if (!FunctionName.empty() && // Merge with an earlier prototype? - (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { - // If this is the case, either we need to be a forward decl, or it needs - // to be. - if (!CurFun.isDeclare && !Fn->isDeclaration()) + (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { + if (Fn->getFunctionType() != FT ) { + // The existing function doesn't have the same type. This is an overload + // error. + GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); + } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { + // Neither the existing or the current function is a declaration and they + // have the same name and same type. Clearly this is a redefinition. GEN_ERROR("Redefinition of function '" + FunctionName + "'"); - - // Make sure to strip off any argument names so we can't get conflicts. - if (Fn->isDeclaration()) + } if (Fn->isDeclaration()) { + // Make sure to strip off any argument names so we can't get conflicts. for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); AI != AE; ++AI) AI->setName(""); + } } else { // Not already defined? Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, CurModule.CurrentModule); @@ -4595,16 +4613,18 @@ yyreduce: // Add all of the arguments we parsed to the function... if ((yyvsp[-4].ArgList)) { // Is null if empty... if (isVarArg) { // Nuke the last entry - assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0&& + assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 && "Not a varargs marker!"); delete (yyvsp[-4].ArgList)->back().Ty; (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); + Function::arg_iterator ArgEnd = Fn->arg_end(); unsigned Idx = 1; - for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++ArgIt) { + for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); + I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->Ty; // Delete the typeholder... - setValueName(ArgIt, I->Name); // Insert arg into symtab... + setValueName(ArgIt, I->Name); // Insert arg into symtab... CHECK_FOR_ERROR InsertValue(ArgIt); Idx++; @@ -4617,7 +4637,7 @@ yyreduce: break; case 210: -#line 2140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2160 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -4629,7 +4649,7 @@ yyreduce: break; case 213: -#line 2151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2171 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR @@ -4637,7 +4657,7 @@ yyreduce: break; case 214: -#line 2156 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2176 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage)); CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility)); @@ -4648,7 +4668,7 @@ yyreduce: break; case 215: -#line 2168 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2188 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -4656,7 +4676,7 @@ yyreduce: break; case 216: -#line 2172 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2192 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -4664,7 +4684,7 @@ yyreduce: break; case 217: -#line 2177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2197 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); CHECK_FOR_ERROR @@ -4672,7 +4692,7 @@ yyreduce: break; case 218: -#line 2181 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2201 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR @@ -4680,7 +4700,7 @@ yyreduce: break; case 219: -#line 2185 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2205 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); CHECK_FOR_ERROR @@ -4688,7 +4708,7 @@ yyreduce: break; case 220: -#line 2189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2209 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR @@ -4696,7 +4716,7 @@ yyreduce: break; case 221: -#line 2193 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2213 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR @@ -4704,7 +4724,7 @@ yyreduce: break; case 222: -#line 2197 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2217 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -4712,7 +4732,7 @@ yyreduce: break; case 223: -#line 2201 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2221 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -4720,7 +4740,7 @@ yyreduce: break; case 224: -#line 2205 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2225 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -4728,7 +4748,7 @@ yyreduce: break; case 225: -#line 2209 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2229 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); int NumElements = (yyvsp[-1].ConstVector)->size(); @@ -4757,7 +4777,7 @@ yyreduce: break; case 226: -#line 2234 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2254 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); CHECK_FOR_ERROR @@ -4765,7 +4785,7 @@ yyreduce: break; case 227: -#line 2238 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2258 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); std::string AsmStr = std::string((yyvsp[-2].StrVal), End); @@ -4779,7 +4799,7 @@ yyreduce: break; case 228: -#line 2252 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2272 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal)); CHECK_FOR_ERROR @@ -4787,7 +4807,7 @@ yyreduce: break; case 229: -#line 2256 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2276 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal)); CHECK_FOR_ERROR @@ -4795,7 +4815,7 @@ yyreduce: break; case 230: -#line 2260 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2280 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal)); CHECK_FOR_ERROR @@ -4803,7 +4823,7 @@ yyreduce: break; case 231: -#line 2264 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2284 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal)); CHECK_FOR_ERROR @@ -4811,7 +4831,7 @@ yyreduce: break; case 234: -#line 2276 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2296 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -4822,7 +4842,7 @@ yyreduce: break; case 235: -#line 2285 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2305 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR @@ -4830,7 +4850,7 @@ yyreduce: break; case 236: -#line 2289 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2309 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR @@ -4838,12 +4858,11 @@ yyreduce: break; case 237: -#line 2298 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2318 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); CHECK_FOR_ERROR InsertValue((yyvsp[0].TermInstVal)); - (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); InsertValue((yyvsp[-2].BasicBlockVal)); (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); @@ -4852,7 +4871,7 @@ yyreduce: break; case 238: -#line 2309 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2328 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast((yyvsp[0].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -4865,7 +4884,7 @@ yyreduce: break; case 239: -#line 2318 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2337 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true); CHECK_FOR_ERROR @@ -4881,7 +4900,7 @@ yyreduce: break; case 240: -#line 2330 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2349 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = getBBVal(ValID::createLocalName((yyvsp[0].StrVal)), true); CHECK_FOR_ERROR @@ -4897,7 +4916,7 @@ yyreduce: break; case 241: -#line 2343 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2362 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Return with a result... (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); CHECK_FOR_ERROR @@ -4905,7 +4924,7 @@ yyreduce: break; case 242: -#line 2347 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2366 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = new ReturnInst(); CHECK_FOR_ERROR @@ -4913,7 +4932,7 @@ yyreduce: break; case 243: -#line 2351 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2370 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR @@ -4922,7 +4941,7 @@ yyreduce: break; case 244: -#line 2356 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2375 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { assert(cast((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?"); BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); @@ -4936,7 +4955,7 @@ yyreduce: break; case 245: -#line 2366 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2385 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); CHECK_FOR_ERROR @@ -4959,7 +4978,7 @@ yyreduce: break; case 246: -#line 2385 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2404 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); CHECK_FOR_ERROR @@ -4972,7 +4991,7 @@ yyreduce: break; case 247: -#line 2395 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2414 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -5042,7 +5061,7 @@ yyreduce: break; case 248: -#line 2461 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2480 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -5050,7 +5069,7 @@ yyreduce: break; case 249: -#line 2465 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2484 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -5058,7 +5077,7 @@ yyreduce: break; case 250: -#line 2472 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2491 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[-5].JumpTable); Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); @@ -5073,7 +5092,7 @@ yyreduce: break; case 251: -#line 2483 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2502 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); @@ -5089,19 +5108,19 @@ yyreduce: break; case 252: -#line 2496 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2515 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - // Is this definition named?? if so, assign the name... - setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); - CHECK_FOR_ERROR - InsertValue((yyvsp[0].InstVal)); - (yyval.InstVal) = (yyvsp[0].InstVal); - CHECK_FOR_ERROR -;} + // Is this definition named?? if so, assign the name... + setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); + CHECK_FOR_ERROR + InsertValue((yyvsp[0].InstVal)); + (yyval.InstVal) = (yyvsp[0].InstVal); + CHECK_FOR_ERROR + ;} break; case 253: -#line 2505 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2525 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription()); @@ -5116,7 +5135,7 @@ yyreduce: break; case 254: -#line 2516 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2536 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[-6].PHIList); Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); @@ -5128,7 +5147,7 @@ yyreduce: break; case 255: -#line 2526 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2546 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); @@ -5140,7 +5159,7 @@ yyreduce: break; case 256: -#line 2534 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2554 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); @@ -5152,17 +5171,17 @@ yyreduce: break; case 257: -#line 2542 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2562 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueRefList) = new ValueRefList(); ;} break; case 258: -#line 2545 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2565 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); ;} break; case 259: -#line 2546 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2566 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[-2].ValueList); (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); @@ -5171,7 +5190,7 @@ yyreduce: break; case 260: -#line 2553 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2573 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5179,7 +5198,7 @@ yyreduce: break; case 261: -#line 2557 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2577 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5187,7 +5206,7 @@ yyreduce: break; case 262: -#line 2562 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2582 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); @@ -5199,7 +5218,7 @@ yyreduce: ((yyvsp[-4].BinaryOpVal) == Instruction::URem || (yyvsp[-4].BinaryOpVal) == Instruction::SRem || (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) - GEN_ERROR("U/S/FRem not supported on packed types"); + GEN_ERROR("Remainder not supported on packed types"); Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); @@ -5212,7 +5231,7 @@ yyreduce: break; case 263: -#line 2583 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2603 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); @@ -5233,7 +5252,7 @@ yyreduce: break; case 264: -#line 2600 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2620 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); @@ -5250,7 +5269,7 @@ yyreduce: break; case 265: -#line 2613 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2633 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); @@ -5267,7 +5286,7 @@ yyreduce: break; case 266: -#line 2626 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2646 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); @@ -5283,7 +5302,7 @@ yyreduce: break; case 267: -#line 2638 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2658 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); @@ -5295,7 +5314,7 @@ yyreduce: break; case 268: -#line 2646 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2666 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); @@ -5306,7 +5325,7 @@ yyreduce: break; case 269: -#line 2653 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2673 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid extractelement operands"); @@ -5316,7 +5335,7 @@ yyreduce: break; case 270: -#line 2659 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2679 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid insertelement operands"); @@ -5326,7 +5345,7 @@ yyreduce: break; case 271: -#line 2665 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2685 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -5336,7 +5355,7 @@ yyreduce: break; case 272: -#line 2671 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2691 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -5355,7 +5374,7 @@ yyreduce: break; case 273: -#line 2687 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2707 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -5422,7 +5441,7 @@ yyreduce: break; case 274: -#line 2750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2770 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR @@ -5430,7 +5449,7 @@ yyreduce: break; case 275: -#line 2755 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2775 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5438,7 +5457,7 @@ yyreduce: break; case 276: -#line 2759 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2779 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5446,7 +5465,7 @@ yyreduce: break; case 277: -#line 2766 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2786 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -5457,7 +5476,7 @@ yyreduce: break; case 278: -#line 2773 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2793 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); @@ -5469,7 +5488,7 @@ yyreduce: break; case 279: -#line 2781 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2801 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -5480,7 +5499,7 @@ yyreduce: break; case 280: -#line 2788 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2808 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); @@ -5492,7 +5511,7 @@ yyreduce: break; case 281: -#line 2796 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2816 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[0].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -5503,7 +5522,7 @@ yyreduce: break; case 282: -#line 2804 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2824 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -5521,7 +5540,7 @@ yyreduce: break; case 283: -#line 2818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2838 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); @@ -5542,7 +5561,7 @@ yyreduce: break; case 284: -#line 2835 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2855 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); @@ -5565,7 +5584,7 @@ yyreduce: } /* Line 1126 of yacc.c. */ -#line 5569 "llvmAsmParser.tab.c" +#line 5588 "llvmAsmParser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -5833,7 +5852,7 @@ yyreturn: } -#line 2852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2872 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions @@ -5875,11 +5894,10 @@ int yyerror(const char *ErrorMsg) { std::string where = std::string((CurFilename == "-") ? std::string("") : CurFilename) + ":" + utostr((unsigned) llvmAsmlineno) + ": "; - std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; - if (yychar == YYEMPTY || yychar == 0) - errMsg += "end-of-file."; - else - errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; + std::string errMsg = where + "error: " + std::string(ErrorMsg); + if (yychar != YYEMPTY && yychar != 0) + errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+ + "'"; GenerateError(errMsg); return 0; } diff --git a/llvm/lib/AsmParser/llvmAsmParser.h.cvs b/llvm/lib/AsmParser/llvmAsmParser.h.cvs index 295a7b88f75b9ddbda6a9f01e97e69de491cbd8b..fa6e8af8d5462aa8a5dc383bb76ec267d6c8aae3 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.h.cvs +++ b/llvm/lib/AsmParser/llvmAsmParser.h.cvs @@ -295,7 +295,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 886 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 900 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 186a93f5b4e0a50173fa71b2303138c55c0301d7..24b0abfdd344912a0de86f1ca889bc436e3d9367 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -17,7 +17,7 @@ #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/CommandLine.h" #include "llvm/ADT/SmallVector.h" @@ -209,7 +209,7 @@ static struct PerFunctionInfo { std::map Values; // Keep track of #'d definitions std::map LateResolveValues; - bool isDeclare; // Is this function a forward declararation? + bool isDeclare; // Is this function a forward declararation? GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. GlobalValue::VisibilityTypes Visibility; @@ -341,24 +341,33 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { // Module constants occupy the lowest numbered slots... std::map::iterator VI = CurModule.Values.find(Ty); - if (VI == CurModule.Values.end()) return 0; - if (D.Num >= VI->second.size()) return 0; + if (VI == CurModule.Values.end()) + return 0; + if (D.Num >= VI->second.size()) + return 0; return VI->second[Num]; } case ValID::LocalName: { // Is it a named definition? - if (!inFunctionScope()) return 0; - SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); - Value *N = SymTab.lookup(Ty, D.Name); - if (N == 0) return 0; + if (!inFunctionScope()) + return 0; + ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); + Value *N = SymTab.lookup(D.Name); + if (N == 0) + return 0; + if (N->getType() != Ty) + return 0; D.destroy(); // Free old strdup'd memory... return N; } case ValID::GlobalName: { // Is it a named definition? - SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); - Value *N = SymTab.lookup(Ty, D.Name); - if (N == 0) return 0; + ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); + Value *N = SymTab.lookup(D.Name); + if (N == 0) + return 0; + if (N->getType() != Ty) + return 0; D.destroy(); // Free old strdup'd memory... return N; @@ -499,8 +508,8 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { break; case ValID::LocalName: // Is it a named definition? Name = ID.Name; - if (Value *N = CurFun.CurrentFunction-> - getValueSymbolTable().lookup(Type::LabelTy, Name)) + Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); + if (N && N->getType()->getTypeID() == Type::LabelTyID) BB = cast(N); break; } @@ -640,8 +649,8 @@ static void setValueName(Value *V, char *NameStr) { } assert(inFunctionScope() && "Must be in function scope!"); - SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); - if (ST.lookup(V->getType(), Name)) { + ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); + if (ST.lookup(Name)) { GenerateError("Redefinition of value '" + Name + "' of type '" + V->getType()->getDescription() + "'"); return; @@ -695,16 +704,21 @@ ParseGlobalVariable(char *NameStr, return GV; } - // If this global has a name, check to see if there is already a definition - // of this global in the module. If so, it is an error. + // If this global has a name if (!Name.empty()) { - // We are a simple redefinition of a value, check to see if it is defined - // the same as the old one. - if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { - GenerateError("Redefinition of global variable named '" + Name + - "' of type '" + Ty->getDescription() + "'"); - return 0; - } + // if the global we're parsing has an initializer (is a definition) and + // has external linkage. + if (Initializer && Linkage != GlobalValue::InternalLinkage) + // If there is already a global with external linkage with this name + if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { + // If we allow this GVar to get created, it will be renamed in the + // symbol table because it conflicts with an existing GVar. We can't + // allow redefinition of GVars whose linking indicates that their name + // must stay the same. Issue the error. + GenerateError("Redefinition of global variable named '" + Name + + "' of type '" + Ty->getDescription() + "'"); + return 0; + } } // Otherwise there is no existing GV to use, create one now. @@ -2078,17 +2092,21 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' CurModule.CurrentModule->getFunctionList().remove(Fn); CurModule.CurrentModule->getFunctionList().push_back(Fn); } else if (!FunctionName.empty() && // Merge with an earlier prototype? - (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { - // If this is the case, either we need to be a forward decl, or it needs - // to be. - if (!CurFun.isDeclare && !Fn->isDeclaration()) + (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { + if (Fn->getFunctionType() != FT ) { + // The existing function doesn't have the same type. This is an overload + // error. + GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); + } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { + // Neither the existing or the current function is a declaration and they + // have the same name and same type. Clearly this is a redefinition. GEN_ERROR("Redefinition of function '" + FunctionName + "'"); - - // Make sure to strip off any argument names so we can't get conflicts. - if (Fn->isDeclaration()) + } if (Fn->isDeclaration()) { + // Make sure to strip off any argument names so we can't get conflicts. for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); AI != AE; ++AI) AI->setName(""); + } } else { // Not already defined? Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, CurModule.CurrentModule); @@ -2115,16 +2133,18 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' // 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().Ty->get() == Type::VoidTy && $5->back().Name == 0&& + assert($5->back().Ty->get() == Type::VoidTy && $5->back().Name == 0 && "Not a varargs marker!"); delete $5->back().Ty; $5->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); + Function::arg_iterator ArgEnd = Fn->arg_end(); unsigned Idx = 1; - for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, ++ArgIt) { + for (ArgListType::iterator I = $5->begin(); + I != $5->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->Ty; // Delete the typeholder... - setValueName(ArgIt, I->Name); // Insert arg into symtab... + setValueName(ArgIt, I->Name); // Insert arg into symtab... CHECK_FOR_ERROR InsertValue(ArgIt); Idx++; @@ -2299,7 +2319,6 @@ BasicBlock : InstructionList OptLocalAssign BBTerminatorInst { setValueName($3, $2); CHECK_FOR_ERROR InsertValue($3); - $1->getInstList().push_back($3); InsertValue($1); $$ = $1; @@ -2494,13 +2513,14 @@ JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef { }; Inst : OptLocalAssign InstVal { - // Is this definition named?? if so, assign the name... - setValueName($2, $1); - CHECK_FOR_ERROR - InsertValue($2); - $$ = $2; - CHECK_FOR_ERROR -}; + // Is this definition named?? if so, assign the name... + setValueName($2, $1); + CHECK_FOR_ERROR + InsertValue($2); + $$ = $2; + CHECK_FOR_ERROR + }; + PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes if (!UpRefs.empty()) @@ -2570,7 +2590,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { ($1 == Instruction::URem || $1 == Instruction::SRem || $1 == Instruction::FRem)) - GEN_ERROR("U/S/FRem not supported on packed types"); + GEN_ERROR("Remainder not supported on packed types"); Value* val1 = getVal(*$2, $3); CHECK_FOR_ERROR Value* val2 = getVal(*$2, $5); @@ -2890,11 +2910,10 @@ int yyerror(const char *ErrorMsg) { std::string where = std::string((CurFilename == "-") ? std::string("") : CurFilename) + ":" + utostr((unsigned) llvmAsmlineno) + ": "; - std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; - if (yychar == YYEMPTY || yychar == 0) - errMsg += "end-of-file."; - else - errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; + std::string errMsg = where + "error: " + std::string(ErrorMsg); + if (yychar != YYEMPTY && yychar != 0) + errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+ + "'"; GenerateError(errMsg); return 0; } diff --git a/llvm/lib/AsmParser/llvmAsmParser.y.cvs b/llvm/lib/AsmParser/llvmAsmParser.y.cvs index 186a93f5b4e0a50173fa71b2303138c55c0301d7..24b0abfdd344912a0de86f1ca889bc436e3d9367 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y.cvs +++ b/llvm/lib/AsmParser/llvmAsmParser.y.cvs @@ -17,7 +17,7 @@ #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/CommandLine.h" #include "llvm/ADT/SmallVector.h" @@ -209,7 +209,7 @@ static struct PerFunctionInfo { std::map Values; // Keep track of #'d definitions std::map LateResolveValues; - bool isDeclare; // Is this function a forward declararation? + bool isDeclare; // Is this function a forward declararation? GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. GlobalValue::VisibilityTypes Visibility; @@ -341,24 +341,33 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { // Module constants occupy the lowest numbered slots... std::map::iterator VI = CurModule.Values.find(Ty); - if (VI == CurModule.Values.end()) return 0; - if (D.Num >= VI->second.size()) return 0; + if (VI == CurModule.Values.end()) + return 0; + if (D.Num >= VI->second.size()) + return 0; return VI->second[Num]; } case ValID::LocalName: { // Is it a named definition? - if (!inFunctionScope()) return 0; - SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); - Value *N = SymTab.lookup(Ty, D.Name); - if (N == 0) return 0; + if (!inFunctionScope()) + return 0; + ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); + Value *N = SymTab.lookup(D.Name); + if (N == 0) + return 0; + if (N->getType() != Ty) + return 0; D.destroy(); // Free old strdup'd memory... return N; } case ValID::GlobalName: { // Is it a named definition? - SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); - Value *N = SymTab.lookup(Ty, D.Name); - if (N == 0) return 0; + ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); + Value *N = SymTab.lookup(D.Name); + if (N == 0) + return 0; + if (N->getType() != Ty) + return 0; D.destroy(); // Free old strdup'd memory... return N; @@ -499,8 +508,8 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { break; case ValID::LocalName: // Is it a named definition? Name = ID.Name; - if (Value *N = CurFun.CurrentFunction-> - getValueSymbolTable().lookup(Type::LabelTy, Name)) + Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); + if (N && N->getType()->getTypeID() == Type::LabelTyID) BB = cast(N); break; } @@ -640,8 +649,8 @@ static void setValueName(Value *V, char *NameStr) { } assert(inFunctionScope() && "Must be in function scope!"); - SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); - if (ST.lookup(V->getType(), Name)) { + ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); + if (ST.lookup(Name)) { GenerateError("Redefinition of value '" + Name + "' of type '" + V->getType()->getDescription() + "'"); return; @@ -695,16 +704,21 @@ ParseGlobalVariable(char *NameStr, return GV; } - // If this global has a name, check to see if there is already a definition - // of this global in the module. If so, it is an error. + // If this global has a name if (!Name.empty()) { - // We are a simple redefinition of a value, check to see if it is defined - // the same as the old one. - if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { - GenerateError("Redefinition of global variable named '" + Name + - "' of type '" + Ty->getDescription() + "'"); - return 0; - } + // if the global we're parsing has an initializer (is a definition) and + // has external linkage. + if (Initializer && Linkage != GlobalValue::InternalLinkage) + // If there is already a global with external linkage with this name + if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { + // If we allow this GVar to get created, it will be renamed in the + // symbol table because it conflicts with an existing GVar. We can't + // allow redefinition of GVars whose linking indicates that their name + // must stay the same. Issue the error. + GenerateError("Redefinition of global variable named '" + Name + + "' of type '" + Ty->getDescription() + "'"); + return 0; + } } // Otherwise there is no existing GV to use, create one now. @@ -2078,17 +2092,21 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' CurModule.CurrentModule->getFunctionList().remove(Fn); CurModule.CurrentModule->getFunctionList().push_back(Fn); } else if (!FunctionName.empty() && // Merge with an earlier prototype? - (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { - // If this is the case, either we need to be a forward decl, or it needs - // to be. - if (!CurFun.isDeclare && !Fn->isDeclaration()) + (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { + if (Fn->getFunctionType() != FT ) { + // The existing function doesn't have the same type. This is an overload + // error. + GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); + } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { + // Neither the existing or the current function is a declaration and they + // have the same name and same type. Clearly this is a redefinition. GEN_ERROR("Redefinition of function '" + FunctionName + "'"); - - // Make sure to strip off any argument names so we can't get conflicts. - if (Fn->isDeclaration()) + } if (Fn->isDeclaration()) { + // Make sure to strip off any argument names so we can't get conflicts. for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); AI != AE; ++AI) AI->setName(""); + } } else { // Not already defined? Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, CurModule.CurrentModule); @@ -2115,16 +2133,18 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' // 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().Ty->get() == Type::VoidTy && $5->back().Name == 0&& + assert($5->back().Ty->get() == Type::VoidTy && $5->back().Name == 0 && "Not a varargs marker!"); delete $5->back().Ty; $5->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); + Function::arg_iterator ArgEnd = Fn->arg_end(); unsigned Idx = 1; - for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, ++ArgIt) { + for (ArgListType::iterator I = $5->begin(); + I != $5->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->Ty; // Delete the typeholder... - setValueName(ArgIt, I->Name); // Insert arg into symtab... + setValueName(ArgIt, I->Name); // Insert arg into symtab... CHECK_FOR_ERROR InsertValue(ArgIt); Idx++; @@ -2299,7 +2319,6 @@ BasicBlock : InstructionList OptLocalAssign BBTerminatorInst { setValueName($3, $2); CHECK_FOR_ERROR InsertValue($3); - $1->getInstList().push_back($3); InsertValue($1); $$ = $1; @@ -2494,13 +2513,14 @@ JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef { }; Inst : OptLocalAssign InstVal { - // Is this definition named?? if so, assign the name... - setValueName($2, $1); - CHECK_FOR_ERROR - InsertValue($2); - $$ = $2; - CHECK_FOR_ERROR -}; + // Is this definition named?? if so, assign the name... + setValueName($2, $1); + CHECK_FOR_ERROR + InsertValue($2); + $$ = $2; + CHECK_FOR_ERROR + }; + PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes if (!UpRefs.empty()) @@ -2570,7 +2590,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { ($1 == Instruction::URem || $1 == Instruction::SRem || $1 == Instruction::FRem)) - GEN_ERROR("U/S/FRem not supported on packed types"); + GEN_ERROR("Remainder not supported on packed types"); Value* val1 = getVal(*$2, $3); CHECK_FOR_ERROR Value* val2 = getVal(*$2, $5); @@ -2890,11 +2910,10 @@ int yyerror(const char *ErrorMsg) { std::string where = std::string((CurFilename == "-") ? std::string("") : CurFilename) + ":" + utostr((unsigned) llvmAsmlineno) + ": "; - std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; - if (yychar == YYEMPTY || yychar == 0) - errMsg += "end-of-file."; - else - errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; + std::string errMsg = where + "error: " + std::string(ErrorMsg); + if (yychar != YYEMPTY && yychar != 0) + errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+ + "'"; GenerateError(errMsg); return 0; } diff --git a/llvm/lib/Bytecode/Reader/Analyzer.cpp b/llvm/lib/Bytecode/Reader/Analyzer.cpp index 64907a8e80d1465a51cfabf2222f84ef327810c2..71cb4b25795bccbc73dde1a4a363bbce6004a9a7 100644 --- a/llvm/lib/Bytecode/Reader/Analyzer.cpp +++ b/llvm/lib/Bytecode/Reader/Analyzer.cpp @@ -270,19 +270,15 @@ public: *os << " } END BLOCK: CompactionTable\n"; } - virtual void handleSymbolTableBegin(Function* CF, SymbolTable* ST) { + virtual void handleTypeSymbolTableBegin(TypeSymbolTable* ST) { bca.numSymTab++; if (os) - *os << " BLOCK: SymbolTable {\n"; + *os << " BLOCK: TypeSymbolTable {\n"; } - - virtual void handleSymbolTablePlane(unsigned Ty, unsigned NumEntries, - const Type* Typ) { - if (os) { - *os << " Plane: Ty=" << Ty << " Size=" << NumEntries << " Type: "; - WriteTypeSymbolic(*os,Typ,M); - *os << "\n"; - } + virtual void handleValueSymbolTableBegin(Function* CF, ValueSymbolTable* ST) { + bca.numSymTab++; + if (os) + *os << " BLOCK: ValueSymbolTable {\n"; } virtual void handleSymbolTableType(unsigned i, unsigned TypSlot, @@ -292,18 +288,23 @@ public: << " Name: " << name << "\n"; } - virtual void handleSymbolTableValue(unsigned i, unsigned ValSlot, - const std::string& name ) { + virtual void handleSymbolTableValue(unsigned TySlot, unsigned ValSlot, + const std::string& name) { if (os) - *os << " Value " << i << " Slot=" << ValSlot + *os << " Value " << TySlot << " Slot=" << ValSlot << " Name: " << name << "\n"; if (ValSlot > bca.maxValueSlot) bca.maxValueSlot = ValSlot; } - virtual void handleSymbolTableEnd() { + virtual void handleValueSymbolTableEnd() { if (os) - *os << " } END BLOCK: SymbolTable\n"; + *os << " } END BLOCK: ValueSymbolTable\n"; + } + + virtual void handleTypeSymbolTableEnd() { + if (os) + *os << " } END BLOCK: TypeSymbolTable\n"; } virtual void handleFunctionBegin(Function* Func, unsigned Size) { @@ -358,15 +359,15 @@ public: } virtual bool handleInstruction( unsigned Opcode, const Type* iType, - std::vector& Operands, unsigned Size){ + std::vector& Operands, + Instruction *Inst, + unsigned Size){ if (os) { *os << " INST: OpCode=" - << Instruction::getOpcodeName(Opcode) << " Type=\""; - WriteTypeSymbolic(*os,iType,M); - *os << "\""; + << Instruction::getOpcodeName(Opcode); for ( unsigned i = 0; i < Operands.size(); ++i ) - *os << " Op(" << i << ")=Slot(" << Operands[i] << ")"; - *os << "\n"; + *os << " Op(" << Operands[i] << ")"; + *os << *Inst; } bca.numInstructions++; diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp index e2505cc81e8b6a261e0e3c08a61857bdb4803a66..ff6d8f04ca8e989d02d02d5625b7ba666a2e39f2 100644 --- a/llvm/lib/Bytecode/Reader/Reader.cpp +++ b/llvm/lib/Bytecode/Reader/Reader.cpp @@ -23,7 +23,6 @@ #include "llvm/Constants.h" #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" -#include "llvm/SymbolTable.h" #include "llvm/TypeSymbolTable.h" #include "llvm/Bytecode/Format.h" #include "llvm/Config/alloca.h" @@ -55,6 +54,7 @@ namespace { inline void BytecodeReader::error(const std::string& err) { ErrorMsg = err + " (Vers=" + itostr(RevisionNum) + ", Pos=" + itostr(At-MemStart) + ")"; + if (Handler) Handler->handleError(ErrorMsg); longjmp(context,1); } @@ -443,10 +443,6 @@ void BytecodeReader::ParseInstruction(std::vector &Oprnds, // of opcodes. Instruction* Result = 0; - // We have enough info to inform the handler now. - if (Handler) - Handler->handleInstruction(Opcode, InstTy, Oprnds, At-SaveAt); - // First, handle the easy binary operators case if (Opcode >= Instruction::BinaryOpsBegin && Opcode < Instruction::BinaryOpsEnd && Oprnds.size() == 2) { @@ -861,6 +857,10 @@ void BytecodeReader::ParseInstruction(std::vector &Oprnds, else TypeSlot = getTypeSlot(Result->getType()); + // We have enough info to inform the handler now. + if (Handler) + Handler->handleInstruction(Opcode, InstTy, Oprnds, Result, At-SaveAt); + insertValue(Result, TypeSlot, FunctionValues); } @@ -936,9 +936,9 @@ void BytecodeReader::ParseTypeSymbolTable(TypeSymbolTable *TST) { /// CurrentFunction's symbol table. For Module level symbol tables, the /// CurrentFunction argument must be zero. void BytecodeReader::ParseValueSymbolTable(Function *CurrentFunction, - SymbolTable *ST) { + ValueSymbolTable *VST) { - if (Handler) Handler->handleSymbolTableBegin(CurrentFunction,ST); + if (Handler) Handler->handleValueSymbolTableBegin(CurrentFunction,VST); // Allow efficient basic block lookup by number. std::vector BBMap; @@ -963,13 +963,15 @@ void BytecodeReader::ParseValueSymbolTable(Function *CurrentFunction, } else { V = getValue(Typ, slot, false); // Find mapping... } + if (Handler) Handler->handleSymbolTableValue(Typ, slot, Name); if (V == 0) - error("Failed value look-up for name '" + Name + "'"); + error("Failed value look-up for name '" + Name + "', type #" + + utostr(Typ) + " slot #" + utostr(slot)); V->setName(Name); } } checkPastBlockEnd("Symbol Table"); - if (Handler) Handler->handleSymbolTableEnd(); + if (Handler) Handler->handleValueSymbolTableEnd(); } // Parse a single type. The typeid is read in first. If its a primitive type diff --git a/llvm/lib/Bytecode/Reader/Reader.h b/llvm/lib/Bytecode/Reader/Reader.h index 92c8fa0225cf5b7fda724596a1ae87cecc52fd2a..b881f9d0a566c1441c04852848265193c1e9e955 100644 --- a/llvm/lib/Bytecode/Reader/Reader.h +++ b/llvm/lib/Bytecode/Reader/Reader.h @@ -28,8 +28,10 @@ namespace llvm { -class BytecodeHandler; ///< Forward declare the handler interface -class TypeSymbolTable; ///< Forward declare +// Forward declarations +class BytecodeHandler; +class TypeSymbolTable; +class ValueSymbolTable; /// This class defines the interface for parsing a buffer of bytecode. The /// parser itself takes no action except to call the various functions of @@ -204,7 +206,7 @@ protected: void ParseTypeSymbolTable(TypeSymbolTable *ST); /// @brief Parse a value symbol table - void ParseValueSymbolTable(Function* Func, SymbolTable *ST); + void ParseValueSymbolTable(Function* Func, ValueSymbolTable *ST); /// @brief Parse functions lazily. void ParseFunctionLazily(); diff --git a/llvm/lib/Bytecode/Writer/SlotCalculator.cpp b/llvm/lib/Bytecode/Writer/SlotCalculator.cpp index 9115ddbc71be009a6a20e1ab2062c983bddad338..197f20601a663a5e453f87833f7ed04230384f2e 100644 --- a/llvm/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/llvm/lib/Bytecode/Writer/SlotCalculator.cpp @@ -21,9 +21,9 @@ #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" #include "llvm/TypeSymbolTable.h" #include "llvm/Type.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Analysis/ConstantsScanner.h" #include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/STLExtras.h" @@ -218,8 +218,8 @@ void SlotCalculator::processModule() { // processTypeSymbolTable - Insert all of the type sin the specified symbol // table. -void SlotCalculator::processTypeSymbolTable(const TypeSymbolTable *ST) { - for (TypeSymbolTable::const_iterator TI = ST->begin(), TE = ST->end(); +void SlotCalculator::processTypeSymbolTable(const TypeSymbolTable *TST) { + for (TypeSymbolTable::const_iterator TI = TST->begin(), TE = TST->end(); TI != TE; ++TI ) getOrCreateSlot(TI->second); } @@ -227,23 +227,18 @@ void SlotCalculator::processTypeSymbolTable(const TypeSymbolTable *ST) { // processSymbolTable - Insert all of the values in the specified symbol table // into the values table... // -void SlotCalculator::processValueSymbolTable(const SymbolTable *ST) { - for (SymbolTable::plane_const_iterator PI = ST->plane_begin(), - PE = ST->plane_end(); PI != PE; ++PI) - for (SymbolTable::value_const_iterator VI = PI->second.begin(), - VE = PI->second.end(); VI != VE; ++VI) - getOrCreateSlot(VI->second); +void SlotCalculator::processValueSymbolTable(const ValueSymbolTable *VST) { + for (ValueSymbolTable::const_iterator VI = VST->begin(), VE = VST->end(); + VI != VE; ++VI) + getOrCreateSlot(VI->second); } -void SlotCalculator::processSymbolTableConstants(const SymbolTable *ST) { +void SlotCalculator::processSymbolTableConstants(const ValueSymbolTable *VST) { // Now do the constant values in all planes - for (SymbolTable::plane_const_iterator PI = ST->plane_begin(), - PE = ST->plane_end(); PI != PE; ++PI) - for (SymbolTable::value_const_iterator VI = PI->second.begin(), - VE = PI->second.end(); VI != VE; ++VI) - if (isa(VI->second) && - !isa(VI->second)) - getOrCreateSlot(VI->second); + for (ValueSymbolTable::const_iterator VI = VST->begin(), VE = VST->end(); + VI != VE; ++VI) + if (isa(VI->second) && !isa(VI->second)) + getOrCreateSlot(VI->second); } diff --git a/llvm/lib/Bytecode/Writer/SlotCalculator.h b/llvm/lib/Bytecode/Writer/SlotCalculator.h index 820099273b7348d62de728006880341c0a958a5d..6cddb30f99ae5eaddd3664cb2a78759ea0f9b994 100644 --- a/llvm/lib/Bytecode/Writer/SlotCalculator.h +++ b/llvm/lib/Bytecode/Writer/SlotCalculator.h @@ -31,6 +31,7 @@ class Module; class Function; class SymbolTable; class TypeSymbolTable; +class ValueSymbolTable; class ConstantArray; class SlotCalculator { @@ -130,8 +131,8 @@ private: // into the values table... // void processTypeSymbolTable(const TypeSymbolTable *ST); - void processValueSymbolTable(const SymbolTable *ST); - void processSymbolTableConstants(const SymbolTable *ST); + void processValueSymbolTable(const ValueSymbolTable *ST); + void processSymbolTableConstants(const ValueSymbolTable *ST); // insertPrimitives - helper for constructors to insert primitive types. void insertPrimitives(); diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp index 0d4ccbddd69e8dc5c3ebfbe74f0a4ae477b1e5d3..a2e8fe566d35633bfe55c7751ccb04126c0841bf 100644 --- a/llvm/lib/Bytecode/Writer/Writer.cpp +++ b/llvm/lib/Bytecode/Writer/Writer.cpp @@ -26,8 +26,8 @@ #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" #include "llvm/TypeSymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/Compressor.h" #include "llvm/Support/MathExtras.h" @@ -1144,21 +1144,31 @@ void BytecodeWriter::outputTypeSymbolTable(const TypeSymbolTable &TST) { } } -void BytecodeWriter::outputValueSymbolTable(const SymbolTable &MST) { +void BytecodeWriter::outputValueSymbolTable(const ValueSymbolTable &VST) { // Do not output the Bytecode block for an empty symbol table, it just wastes // space! - if (MST.isEmpty()) return; + if (VST.empty()) return; BytecodeBlock SymTabBlock(BytecodeFormat::ValueSymbolTableBlockID, *this, true/*ElideIfEmpty*/); - // Now do each of the type planes in order. - for (SymbolTable::plane_const_iterator PI = MST.plane_begin(), - PE = MST.plane_end(); PI != PE; ++PI) { - SymbolTable::value_const_iterator I = MST.value_begin(PI->first); - SymbolTable::value_const_iterator End = MST.value_end(PI->first); + // Organize the symbol table by type + typedef std::pair PlaneMapEntry; + typedef std::vector PlaneMapVector; + typedef std::map PlaneMap; + PlaneMap Planes; + for (ValueSymbolTable::const_iterator SI = VST.begin(), SE = VST.end(); + SI != SE; ++SI) + Planes[SI->second->getType()].push_back( + std::make_pair(SI->first,SI->second)); + + for (PlaneMap::const_iterator PI = Planes.begin(), PE = Planes.end(); + PI != PE; ++PI) { int Slot; + PlaneMapVector::const_iterator I = PI->second.begin(); + PlaneMapVector::const_iterator End = PI->second.end(); + if (I == End) continue; // Don't mess with an absent type... // Write the number of values in this plane diff --git a/llvm/lib/Bytecode/Writer/WriterInternals.h b/llvm/lib/Bytecode/Writer/WriterInternals.h index c518c01b94f75c7d970c65eac6f7072a71cde6b6..f3c59f3288024f568a6b0a56a3608406826f9552 100644 --- a/llvm/lib/Bytecode/Writer/WriterInternals.h +++ b/llvm/lib/Bytecode/Writer/WriterInternals.h @@ -26,6 +26,7 @@ namespace llvm { class InlineAsm; class TypeSymbolTable; + class ValueSymbolTable; class BytecodeWriter { std::vector &Out; @@ -66,7 +67,7 @@ private: void outputModuleInfoBlock(const Module *C); void outputTypeSymbolTable(const TypeSymbolTable &TST); - void outputValueSymbolTable(const SymbolTable &ST); + void outputValueSymbolTable(const ValueSymbolTable &ST); void outputTypes(unsigned StartNo); void outputConstantsInPlane(const std::vector &Plane, unsigned StartNo); diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 2d16495b429b5a8745266be4a5b6caebe803fc2b..83765345bb1d755c120e1094f50032062d187d29 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -20,8 +20,8 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" #include "llvm/TypeSymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Instructions.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/Streams.h" @@ -273,7 +273,8 @@ static void PrintMap(const std::map &M) { static Value *RemapOperand(const Value *In, std::map &ValueMap) { std::map::const_iterator I = ValueMap.find(In); - if (I != ValueMap.end()) return I->second; + if (I != ValueMap.end()) + return I->second; // Check to see if it's a constant that we are interested in transforming. Value *Result = 0; @@ -333,20 +334,34 @@ static Value *RemapOperand(const Value *In, /// through the trouble to force this back. static void ForceRenaming(GlobalValue *GV, const std::string &Name) { assert(GV->getName() != Name && "Can't force rename to self"); - SymbolTable &ST = GV->getParent()->getValueSymbolTable(); + ValueSymbolTable &ST = GV->getParent()->getValueSymbolTable(); // If there is a conflict, rename the conflict. - Value *ConflictVal = ST.lookup(GV->getType(), Name); - assert(ConflictVal&&"Why do we have to force rename if there is no conflic?"); - GlobalValue *ConflictGV = cast(ConflictVal); - assert(ConflictGV->hasInternalLinkage() && - "Not conflicting with a static global, should link instead!"); - - ConflictGV->setName(""); // Eliminate the conflict - GV->setName(Name); // Force the name back - ConflictGV->setName(Name); // This will cause ConflictGV to get renamed - assert(GV->getName() == Name && ConflictGV->getName() != Name && - "ForceRenaming didn't work"); + GlobalValue *ConflictGV = cast_or_null(ST.lookup(Name)); + if (ConflictGV) { + assert(ConflictGV->hasInternalLinkage() && + "Not conflicting with a static global, should link instead!"); + ConflictGV->setName(""); // Eliminate the conflict + } + GV->setName(Name); // Force the name back + if (ConflictGV) { + ConflictGV->setName(Name); // This will cause ConflictGV to get renamed + assert(ConflictGV->getName() != Name && "ForceRenaming didn't work"); + } + assert(GV->getName() == Name && "ForceRenaming didn't work"); +} + +/// CopyGVAttributes - copy additional attributes (those not needed to construct +/// a GlobalValue) from the SrcGV to the DestGV. +static void CopyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) { + // Propagate alignment, visibility and section info. + DestGV->setAlignment(std::max(DestGV->getAlignment(), SrcGV->getAlignment())); + DestGV->setSection(SrcGV->getSection()); + DestGV->setVisibility(SrcGV->getVisibility()); + if (const Function *SrcF = dyn_cast(SrcGV)) { + Function *DestF = cast(DestGV); + DestF->setCallingConv(SrcF->getCallingConv()); + } } /// GetLinkageResult - This analyzes the two global values and determines what @@ -431,29 +446,20 @@ static bool GetLinkageResult(GlobalValue *Dest, GlobalValue *Src, static bool LinkGlobals(Module *Dest, Module *Src, std::map &ValueMap, std::multimap &AppendingVars, - std::map &GlobalsByName, std::string *Err) { - // We will need a module level symbol table if the src module has a module - // level symbol table... - TypeSymbolTable *TST = &Dest->getTypeSymbolTable(); - // Loop over all of the globals in the src module, mapping them over as we go for (Module::global_iterator I = Src->global_begin(), E = Src->global_end(); I != E; ++I) { GlobalVariable *SGV = I; GlobalVariable *DGV = 0; // Check to see if may have to link the global. - if (SGV->hasName() && !SGV->hasInternalLinkage()) - if (!(DGV = Dest->getGlobalVariable(SGV->getName(), - SGV->getType()->getElementType()))) { - std::map::iterator EGV = - GlobalsByName.find(SGV->getName()); - if (EGV != GlobalsByName.end()) - DGV = dyn_cast(EGV->second); - if (DGV) - // If types don't agree due to opaque types, try to resolve them. - RecursiveResolveTypes(SGV->getType(), DGV->getType(), TST, ""); - } + if (SGV->hasName() && !SGV->hasInternalLinkage()) { + DGV = Dest->getGlobalVariable(SGV->getName()); + if (DGV && DGV->getType() != SGV->getType()) + // If types don't agree due to opaque types, try to resolve them. + RecursiveResolveTypes(SGV->getType(), DGV->getType(), + &Dest->getTypeSymbolTable(), ""); + } if (DGV && DGV->hasInternalLinkage()) DGV = 0; @@ -476,9 +482,7 @@ static bool LinkGlobals(Module *Dest, Module *Src, SGV->isConstant(), SGV->getLinkage(), /*init*/0, SGV->getName(), Dest); // Propagate alignment, visibility and section info. - NewDGV->setAlignment(SGV->getAlignment()); - NewDGV->setSection(SGV->getSection()); - NewDGV->setVisibility(SGV->getVisibility()); + CopyGVAttributes(NewDGV, SGV); // If the LLVM runtime renamed the global, but it is an externally visible // symbol, DGV must be an existing global with internal linkage. Rename @@ -502,9 +506,8 @@ static bool LinkGlobals(Module *Dest, Module *Src, "", Dest); // Propagate alignment, section and visibility info. - NewDGV->setAlignment(std::max(DGV->getAlignment(), SGV->getAlignment())); - NewDGV->setSection(SGV->getSection()); - NewDGV->setVisibility(SGV->getVisibility()); + NewDGV->setAlignment(DGV->getAlignment()); + CopyGVAttributes(NewDGV, SGV); // Make sure to remember this mapping... ValueMap.insert(std::make_pair(SGV, NewDGV)); @@ -513,9 +516,7 @@ static bool LinkGlobals(Module *Dest, Module *Src, AppendingVars.insert(std::make_pair(SGV->getName(), NewDGV)); } else { // Propagate alignment, section, and visibility info. - DGV->setAlignment(std::max(DGV->getAlignment(), SGV->getAlignment())); - DGV->setSection(SGV->getSection()); - DGV->setVisibility(SGV->getVisibility()); + CopyGVAttributes(DGV, SGV); // Otherwise, perform the mapping as instructed by GetLinkageResult. If // the types don't match, and if we are to link from the source, nuke DGV @@ -524,9 +525,7 @@ static bool LinkGlobals(Module *Dest, Module *Src, GlobalVariable *NewDGV = new GlobalVariable(SGV->getType()->getElementType(), DGV->isConstant(), DGV->getLinkage()); - NewDGV->setAlignment(DGV->getAlignment()); - NewDGV->setSection(DGV->getSection()); - NewDGV->setVisibility(DGV->getVisibility()); + CopyGVAttributes(NewDGV, DGV); Dest->getGlobalList().insert(DGV, NewDGV); DGV->replaceAllUsesWith( ConstantExpr::getBitCast(NewDGV, DGV->getType())); @@ -607,33 +606,64 @@ static bool LinkGlobalInits(Module *Dest, const Module *Src, // static bool LinkFunctionProtos(Module *Dest, const Module *Src, std::map &ValueMap, - std::map &GlobalsByName, std::string *Err) { - TypeSymbolTable *TST = &Dest->getTypeSymbolTable(); - // Loop over all of the functions in the src module, mapping them over for (Module::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) { const Function *SF = I; // SrcFunction Function *DF = 0; if (SF->hasName() && !SF->hasInternalLinkage()) { // Check to see if may have to link the function. - if (!(DF = Dest->getFunction(SF->getName(), SF->getFunctionType()))) { - std::map::iterator EF = - GlobalsByName.find(SF->getName()); - if (EF != GlobalsByName.end()) - DF = dyn_cast(EF->second); - if (DF && RecursiveResolveTypes(SF->getType(), DF->getType(), TST, "")) - DF = 0; // FIXME: gross. - } + DF = Dest->getFunction(SF->getName()); + if (DF && SF->getType() != DF->getType()) + // If types don't agree because of opaque, try to resolve them + RecursiveResolveTypes(SF->getType(), DF->getType(), + &Dest->getTypeSymbolTable(), ""); } - - if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) { + + if (DF && DF->getType() != SF->getType()) { + if (DF->isDeclaration() && !SF->isDeclaration()) { + // We have a definition of the same name but different type in the + // source module. Copy the prototype to the destination and replace + // uses of the destination's prototype with the new prototype. + Function *NewDF = new Function(SF->getFunctionType(), SF->getLinkage(), + SF->getName(), Dest); + CopyGVAttributes(NewDF, SF); + + // Any uses of DF need to change to NewDF, with cast + DF->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF, DF->getType())); + + // DF will conflict with NewDF because they both had the same. We must + // erase this now so ForceRenaming doesn't assert because DF might + // not have internal linkage. + DF->eraseFromParent(); + + // If the symbol table renamed the function, but it is an externally + // visible symbol, DF must be an existing function with internal + // linkage. Rename it. + if (NewDF->getName() != SF->getName() && !NewDF->hasInternalLinkage()) + ForceRenaming(NewDF, SF->getName()); + + // Remember this mapping so uses in the source module get remapped + // later by RemapOperand. + ValueMap[SF] = NewDF; + } else if (SF->isDeclaration()) { + // We have two functions of the same name but different type and the + // source is a declaration while the destination is not. Any use of + // the source must be mapped to the destination, with a cast. + ValueMap[SF] = ConstantExpr::getBitCast(DF, SF->getType()); + } else { + // We have two functions of the same name but different types and they + // are both definitions. This is an error. + return Error(Err, "Function '" + DF->getName() + "' defined as both '" + + ToStr(SF->getFunctionType(), Src) + "' and '" + + ToStr(DF->getFunctionType(), Dest) + "'"); + } + } else if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) { // Function does not already exist, simply insert an function signature // identical to SF into the dest module... Function *NewDF = new Function(SF->getFunctionType(), SF->getLinkage(), SF->getName(), Dest); - NewDF->setCallingConv(SF->getCallingConv()); + CopyGVAttributes(NewDF, SF); // If the LLVM runtime renamed the function, but it is an externally // visible symbol, DF must be an existing function with internal linkage. @@ -644,8 +674,8 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src, // ... and remember this mapping... ValueMap.insert(std::make_pair(SF, NewDF)); } else if (SF->isDeclaration()) { - // If SF is external or if both SF & DF are external.. Just link the - // external functions, we aren't adding anything. + // If SF is a declaration or if both SF & DF are declarations, just link + // the declarations, we aren't adding anything. if (SF->hasDLLImportLinkage()) { if (DF->isDeclaration()) { ValueMap.insert(std::make_pair(SF, DF)); @@ -668,8 +698,6 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src, if ((DF->hasLinkOnceLinkage() && SF->hasWeakLinkage()) || DF->hasExternalWeakLinkage()) DF->setLinkage(SF->getLinkage()); - - } else if (DF->hasWeakLinkage() || DF->hasLinkOnceLinkage()) { // At this point we know that SF has LinkOnce or External* linkage. ValueMap.insert(std::make_pair(SF, DF)); @@ -677,10 +705,10 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src, // Don't inherit linkonce & external weak linkage DF->setLinkage(SF->getLinkage()); } else if (SF->getLinkage() != DF->getLinkage()) { - return Error(Err, "Functions named '" + SF->getName() + - "' have different linkage specifiers!"); + return Error(Err, "Functions named '" + SF->getName() + + "' have different linkage specifiers!"); } else if (SF->hasExternalLinkage()) { - // The function is defined in both modules!! + // The function is defined identically in both modules!! return Error(Err, "Function '" + ToStr(SF->getFunctionType(), Src) + "':\"" + SF->getName() + "\" - Function is already defined!"); @@ -695,7 +723,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src, // fix up references to values. At this point we know that Dest is an external // function, and that Src is not. static bool LinkFunctionBody(Function *Dest, Function *Src, - std::map &GlobalMap, + std::map &ValueMap, std::string *Err) { assert(Src && Dest && Dest->isDeclaration() && !Src->isDeclaration()); @@ -706,7 +734,7 @@ static bool LinkFunctionBody(Function *Dest, Function *Src, DI->setName(I->getName()); // Copy the name information over... // Add a mapping to our local map - GlobalMap.insert(std::make_pair(I, DI)); + ValueMap.insert(std::make_pair(I, DI)); } // Splice the body of the source function into the dest function. @@ -722,12 +750,12 @@ static bool LinkFunctionBody(Function *Dest, Function *Src, for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end(); OI != OE; ++OI) if (!isa(*OI) && !isa(*OI)) - *OI = RemapOperand(*OI, GlobalMap); + *OI = RemapOperand(*OI, ValueMap); // There is no need to map the arguments anymore. for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end(); I != E; ++I) - GlobalMap.erase(I); + ValueMap.erase(I); return false; } @@ -747,11 +775,10 @@ static bool LinkFunctionBodies(Module *Dest, Module *Src, Function *DF = cast(ValueMap[SF]); // Destination function // DF not external SF external? - if (DF->isDeclaration()) { + if (DF->isDeclaration()) // Only provide the function body if there isn't one already. if (LinkFunctionBody(DF, SF, ValueMap, Err)) return true; - } } } return false; @@ -919,32 +946,17 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) { // with appending linkage. After the module is linked together, they are // appended and the module is rewritten. std::multimap AppendingVars; - - // GlobalsByName - The LLVM SymbolTable class fights our best efforts at - // linking by separating globals by type. Until PR411 is fixed, we replicate - // it's functionality here. - std::map GlobalsByName; - for (Module::global_iterator I = Dest->global_begin(), E = Dest->global_end(); I != E; ++I) { // Add all of the appending globals already in the Dest module to // AppendingVars. if (I->hasAppendingLinkage()) AppendingVars.insert(std::make_pair(I->getName(), I)); - - // Keep track of all globals by name. - if (!I->hasInternalLinkage() && I->hasName()) - GlobalsByName[I->getName()] = I; } - // Keep track of all globals by name. - for (Module::iterator I = Dest->begin(), E = Dest->end(); I != E; ++I) - if (!I->hasInternalLinkage() && I->hasName()) - GlobalsByName[I->getName()] = I; - // Insert all of the globals in src into the Dest module... without linking // initializers (which could refer to functions not yet mapped over). - if (LinkGlobals(Dest, Src, ValueMap, AppendingVars, GlobalsByName, ErrorMsg)) + if (LinkGlobals(Dest, Src, ValueMap, AppendingVars, ErrorMsg)) return true; // Link the functions together between the two modules, without doing function @@ -952,7 +964,7 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) { // function... We do this so that when we begin processing function bodies, // all of the global values that may be referenced are available in our // ValueMap. - if (LinkFunctionProtos(Dest, Src, ValueMap, GlobalsByName, ErrorMsg)) + if (LinkFunctionProtos(Dest, Src, ValueMap, ErrorMsg)) return true; // Update the initializers in the Dest module now that all globals that may diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp index 6116bcdd765bb3e3a957a7e0bf8e0a2c5a031e48..ffa3b1ec3f7c459776471a7c084510ad7325087e 100644 --- a/llvm/lib/Target/CBackend/CBackend.cpp +++ b/llvm/lib/Target/CBackend/CBackend.cpp @@ -20,7 +20,6 @@ #include "llvm/Instructions.h" #include "llvm/Pass.h" #include "llvm/PassManager.h" -#include "llvm/SymbolTable.h" #include "llvm/TypeSymbolTable.h" #include "llvm/Intrinsics.h" #include "llvm/IntrinsicInst.h" diff --git a/llvm/lib/Transforms/IPO/LoopExtractor.cpp b/llvm/lib/Transforms/IPO/LoopExtractor.cpp index 5a6e7671d1b9cf3b452f4b6810c2d0ca271b637d..7169b503b21cd9a772105ff702673ebe5877242f 100644 --- a/llvm/lib/Transforms/IPO/LoopExtractor.cpp +++ b/llvm/lib/Transforms/IPO/LoopExtractor.cpp @@ -167,7 +167,8 @@ bool BlockExtractorPass::runOnModule(Module &M) { Function *F = BB->getParent(); // Map the corresponding function in this module. - Function *MF = M.getFunction(F->getName(), F->getFunctionType()); + Function *MF = M.getFunction(F->getName()); + assert(MF->getFunctionType() == F->getFunctionType() && "Wrong function?"); // Figure out which index the basic block is in its function. Function::iterator BBI = MF->begin(); diff --git a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp index 6082780e35480e73a1dac3e518554f05cd3772df..c5a9cbf4478a5e5d62e9bdd83d56564b5ced6ceb 100644 --- a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp @@ -65,47 +65,65 @@ ModulePass *llvm::createRaiseAllocationsPass() { // function into the appropriate instruction. // void RaiseAllocations::doInitialization(Module &M) { - const FunctionType *MallocType = // Get the type for malloc - FunctionType::get(PointerType::get(Type::Int8Ty), - std::vector(1, Type::Int64Ty), false); - - const FunctionType *FreeType = // Get the type for free - FunctionType::get(Type::VoidTy, - std::vector(1, PointerType::get(Type::Int8Ty)), - false); // Get Malloc and free prototypes if they exist! - MallocFunc = M.getFunction("malloc", MallocType); - FreeFunc = M.getFunction("free" , FreeType); - - // Check to see if the prototype is wrong, giving us sbyte*(uint) * malloc - // This handles the common declaration of: 'void *malloc(unsigned);' - if (MallocFunc == 0) { - MallocType = FunctionType::get(PointerType::get(Type::Int8Ty), - std::vector(1, Type::Int32Ty), false); - MallocFunc = M.getFunction("malloc", MallocType); - } - - // Check to see if the prototype is missing, giving us sbyte*(...) * malloc - // This handles the common declaration of: 'void *malloc();' - if (MallocFunc == 0) { - MallocType = FunctionType::get(PointerType::get(Type::Int8Ty), - std::vector(), true); - MallocFunc = M.getFunction("malloc", MallocType); - } - - // Check to see if the prototype was forgotten, giving us void (...) * free - // This handles the common forward declaration of: 'void free();' - if (FreeFunc == 0) { - FreeType = FunctionType::get(Type::VoidTy, std::vector(),true); - FreeFunc = M.getFunction("free", FreeType); + MallocFunc = M.getFunction("malloc"); + if (MallocFunc) { + const FunctionType* TyWeHave = MallocFunc->getFunctionType(); + + // Get the expected prototype for malloc + const FunctionType *Malloc1Type = + FunctionType::get(PointerType::get(Type::Int8Ty), + std::vector(1, Type::Int64Ty), false); + + // Chck to see if we got the expected malloc + if (TyWeHave != Malloc1Type) { + // Check to see if the prototype is wrong, giving us sbyte*(uint) * malloc + // This handles the common declaration of: 'void *malloc(unsigned);' + const FunctionType *Malloc2Type = + FunctionType::get(PointerType::get(Type::Int8Ty), + std::vector(1, Type::Int32Ty), false); + if (TyWeHave != Malloc2Type) { + // Check to see if the prototype is missing, giving us + // sbyte*(...) * malloc + // This handles the common declaration of: 'void *malloc();' + const FunctionType *Malloc3Type = + FunctionType::get(PointerType::get(Type::Int8Ty), + std::vector(), true); + if (TyWeHave != Malloc3Type) + // Give up + MallocFunc = 0; + } + } } - // One last try, check to see if we can find free as 'int (...)* free'. This - // handles the case where NOTHING was declared. - if (FreeFunc == 0) { - FreeType = FunctionType::get(Type::Int32Ty, std::vector(),true); - FreeFunc = M.getFunction("free", FreeType); + FreeFunc = M.getFunction("free"); + if (FreeFunc) { + const FunctionType* TyWeHave = FreeFunc->getFunctionType(); + + // Get the expected prototype for void free(i8*) + const FunctionType *Free1Type = FunctionType::get(Type::VoidTy, + std::vector(1, PointerType::get(Type::Int8Ty)), false); + + if (TyWeHave != Free1Type) { + // Check to see if the prototype was forgotten, giving us + // void (...) * free + // This handles the common forward declaration of: 'void free();' + const FunctionType* Free2Type = FunctionType::get(Type::VoidTy, + std::vector(),true); + + if (TyWeHave != Free2Type) { + // One last try, check to see if we can find free as + // int (...)* free. This handles the case where NOTHING was declared. + const FunctionType* Free3Type = FunctionType::get(Type::Int32Ty, + std::vector(),true); + + if (TyWeHave != Free3Type) { + // Give up. + FreeFunc = 0; + } + } + } } // Don't mess with locally defined versions of these functions... diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp index 12cd7fe893845e4309afeb5b1199f799a841adfe..db4387fa54e005a24f9362ac796a7226e71c839e 100644 --- a/llvm/lib/Transforms/IPO/StripSymbols.cpp +++ b/llvm/lib/Transforms/IPO/StripSymbols.cpp @@ -28,7 +28,7 @@ #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/Pass.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/TypeSymbolTable.h" using namespace llvm; diff --git a/llvm/lib/Transforms/Utils/CloneModule.cpp b/llvm/lib/Transforms/Utils/CloneModule.cpp index d481aea0e536d8406e081d4cb6ca88fc296c2d90..669b4b2d051e48b90b6147398e743532beaa6a6f 100644 --- a/llvm/lib/Transforms/Utils/CloneModule.cpp +++ b/llvm/lib/Transforms/Utils/CloneModule.cpp @@ -15,7 +15,6 @@ #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" -#include "llvm/SymbolTable.h" #include "llvm/TypeSymbolTable.h" #include "llvm/Constant.h" #include "ValueMapper.h" diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index f13a140b63846f37c3b0e9e7a6606abe61b81b93..e834c53db3fbdbcb1ba621a575bf3c4a54f5949b 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -24,7 +24,7 @@ #include "llvm/Instruction.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/TypeSymbolTable.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 79673f034d378a2c236833a828a67cfe6081611f..8a6e11de3abc89b9848126c03f6cf7d446ece467 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -16,7 +16,6 @@ #include "llvm/DerivedTypes.h" #include "llvm/GlobalValue.h" #include "llvm/Instructions.h" -#include "llvm/SymbolTable.h" #include "llvm/Module.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Compiler.h" @@ -24,6 +23,7 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MathExtras.h" #include +#include using namespace llvm; //===----------------------------------------------------------------------===// diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index cf8fcdec6a879d2f88d88c711a4912c902545173..cc0cefad66bc58c3478a6a797e1ff39f5d451dce 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -7,8 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file implements the Function & GlobalVariable classes for the VMCore -// library. +// This file implements the Function class for the VMCore library. // //===----------------------------------------------------------------------===// @@ -82,7 +81,7 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage, BasicBlocks.setParent(this); ArgumentList.setItemParent(this); ArgumentList.setParent(this); - SymTab = new SymbolTable(); + SymTab = new ValueSymbolTable(); assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy) && "LLVM functions cannot return aggregate values!"); @@ -138,7 +137,6 @@ void Function::eraseFromParent() { getParent()->getFunctionList().erase(this); } - // dropAllReferences() - This function causes all the subinstructions to "let // go" of all references that they are maintaining. This allows one to // 'delete' a whole class at a time, even though there may be circular diff --git a/llvm/lib/VMCore/Globals.cpp b/llvm/lib/VMCore/Globals.cpp index e49f47766f48fbe67ec497157db8e4b0b8ef5e82..327e2ad9aa2698b4a33eb674cbfa899f2b864886 100644 --- a/llvm/lib/VMCore/Globals.cpp +++ b/llvm/lib/VMCore/Globals.cpp @@ -15,7 +15,6 @@ #include "llvm/GlobalVariable.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" #include "llvm/Support/LeakDetector.h" using namespace llvm; diff --git a/llvm/lib/VMCore/Instruction.cpp b/llvm/lib/VMCore/Instruction.cpp index b2eb87d49e9fa7cf20eeae5dceac615de88ad2dd..6b2babaeccb6c1c056e872038a398680a5d04397 100644 --- a/llvm/lib/VMCore/Instruction.cpp +++ b/llvm/lib/VMCore/Instruction.cpp @@ -14,7 +14,6 @@ #include "llvm/Type.h" #include "llvm/Instructions.h" #include "llvm/Function.h" -#include "llvm/SymbolTable.h" #include "llvm/Support/LeakDetector.h" using namespace llvm; diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp index efa6e6c7c090ba2cb5f9793beee354a8afb7bfff..163d8d2ac173797909502b7616020a9b8efd39db 100644 --- a/llvm/lib/VMCore/Module.cpp +++ b/llvm/lib/VMCore/Module.cpp @@ -69,7 +69,7 @@ Module::Module(const std::string &MID) FunctionList.setParent(this); GlobalList.setItemParent(this); GlobalList.setParent(this); - ValSymTab = new SymbolTable(); + ValSymTab = new ValueSymbolTable(); TypeSymTab = new TypeSymbolTable(); } @@ -132,15 +132,19 @@ Module::PointerSize Module::getPointerSize() const { // Methods for easy access to the functions in the module. // +// getOrInsertFunction - Look up the specified function in the module symbol +// table. If it does not exist, add a prototype for the function and return +// it. This is nice because it allows most passes to get away with not handling +// the symbol table directly for this common task. +// Constant *Module::getOrInsertFunction(const std::string &Name, const FunctionType *Ty) { - SymbolTable &SymTab = getValueSymbolTable(); + ValueSymbolTable &SymTab = getValueSymbolTable(); - // See if we have a definitions for the specified function already. - Function *F = - dyn_cast_or_null(SymTab.lookup(PointerType::get(Ty), Name)); + // See if we have a definition for the specified function already. + Function *F = dyn_cast_or_null(SymTab.lookup(Name)); if (F == 0) { - // Nope, add it. + // Nope, add it Function *New = new Function(Ty, GlobalVariable::ExternalLinkage, Name); FunctionList.push_back(New); return New; // Return the new prototype. @@ -149,7 +153,7 @@ Constant *Module::getOrInsertFunction(const std::string &Name, // Okay, the function exists. Does it have externally visible linkage? if (F->hasInternalLinkage()) { // Rename the function. - F->setName(SymTab.getUniqueName(F->getType(), F->getName())); + F->setName(SymTab.getUniqueName(F->getName())); // Retry, now there won't be a conflict. return getOrInsertFunction(Name, Ty); } @@ -188,73 +192,9 @@ Constant *Module::getOrInsertFunction(const std::string &Name, // getFunction - Look up the specified function in the module symbol table. // If it does not exist, return null. // -Function *Module::getFunction(const std::string &Name, const FunctionType *Ty) { - SymbolTable &SymTab = getValueSymbolTable(); - return cast_or_null(SymTab.lookup(PointerType::get(Ty), Name)); -} - - -/// getMainFunction - This function looks up main efficiently. This is such a -/// common case, that it is a method in Module. If main cannot be found, a -/// null pointer is returned. -/// -Function *Module::getMainFunction() { - std::vector Params; - - // int main(void)... - if (Function *F = getFunction("main", FunctionType::get(Type::Int32Ty, - Params, false))) - return F; - - // void main(void)... - if (Function *F = getFunction("main", FunctionType::get(Type::VoidTy, - Params, false))) - return F; - - Params.push_back(Type::Int32Ty); - - // int main(int argc)... - if (Function *F = getFunction("main", FunctionType::get(Type::Int32Ty, - Params, false))) - return F; - - // void main(int argc)... - if (Function *F = getFunction("main", FunctionType::get(Type::VoidTy, - Params, false))) - return F; - - for (unsigned i = 0; i != 2; ++i) { // Check argv and envp - Params.push_back(PointerType::get(PointerType::get(Type::Int8Ty))); - - // int main(int argc, char **argv)... - if (Function *F = getFunction("main", FunctionType::get(Type::Int32Ty, - Params, false))) - return F; - - // void main(int argc, char **argv)... - if (Function *F = getFunction("main", FunctionType::get(Type::VoidTy, - Params, false))) - return F; - } - - // Ok, try to find main the hard way... - return getNamedFunction("main"); -} - -/// getNamedFunction - Return the first function in the module with the -/// specified name, of arbitrary type. This method returns null if a function -/// with the specified name is not found. -/// -Function *Module::getNamedFunction(const std::string &Name) const { - // Loop over all of the functions, looking for the function desired - const Function *Found = 0; - for (const_iterator I = begin(), E = end(); I != E; ++I) - if (I->getName() == Name) - if (I->isDeclaration()) - Found = I; - else - return const_cast(&(*I)); - return const_cast(Found); // Non-external function not found... +Function *Module::getFunction(const std::string &Name) const { + const ValueSymbolTable &SymTab = getValueSymbolTable(); + return dyn_cast_or_null(SymTab.lookup(Name)); } //===----------------------------------------------------------------------===// @@ -269,31 +209,15 @@ Function *Module::getNamedFunction(const std::string &Name) const { /// have InternalLinkage. By default, these types are not returned. /// GlobalVariable *Module::getGlobalVariable(const std::string &Name, - const Type *Ty, bool AllowInternal) { - if (Value *V = getValueSymbolTable().lookup(PointerType::get(Ty), Name)) { - GlobalVariable *Result = cast(V); - if (AllowInternal || !Result->hasInternalLinkage()) + bool AllowInternal) const { + if (Value *V = ValSymTab->lookup(Name)) { + GlobalVariable *Result = dyn_cast(V); + if (Result && (AllowInternal || !Result->hasInternalLinkage())) return Result; } return 0; } -/// getNamedGlobal - Return the first global variable in the module with the -/// specified name, of arbitrary type. This method returns null if a global -/// with the specified name is not found. -/// -GlobalVariable *Module::getNamedGlobal(const std::string &Name) const { - // FIXME: This would be much faster with a symbol table that doesn't - // discriminate based on type! - for (const_global_iterator I = global_begin(), E = global_end(); - I != E; ++I) - if (I->getName() == Name) - return const_cast(&(*I)); - return 0; -} - - - //===----------------------------------------------------------------------===// // Methods for easy access to the types in the module. // diff --git a/llvm/lib/VMCore/SymbolTable.cpp b/llvm/lib/VMCore/SymbolTable.cpp deleted file mode 100644 index 2edd3eb875054c2cdfb784722dee6ca0ee1ef08e..0000000000000000000000000000000000000000 --- a/llvm/lib/VMCore/SymbolTable.cpp +++ /dev/null @@ -1,336 +0,0 @@ -//===-- SymbolTable.cpp - Implement the SymbolTable class -----------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and revised by Reid -// Spencer. It is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the SymbolTable class for the VMCore library. -// -//===----------------------------------------------------------------------===// - -#include "llvm/SymbolTable.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Module.h" -#include "llvm/ADT/StringExtras.h" -#include "llvm/Support/Debug.h" -#include -using namespace llvm; - -#define DEBUG_SYMBOL_TABLE 0 -#define DEBUG_ABSTYPE 0 - -SymbolTable::~SymbolTable() { - // TODO: FIXME: BIG ONE: This doesn't unreference abstract types for the - // planes that could still have entries! - -#ifndef NDEBUG // Only do this in -g mode... - bool LeftoverValues = true; - for (plane_iterator PI = pmap.begin(); PI != pmap.end(); ++PI) { - for (value_iterator VI = PI->second.begin(); VI != PI->second.end(); ++VI) - if (!isa(VI->second) ) { - DOUT << "Value still in symbol table! Type = '" - << PI->first->getDescription() << "' Name = '" - << VI->first << "'\n"; - LeftoverValues = false; - } - } - - assert(LeftoverValues && "Values remain in symbol table!"); -#endif -} - -// getUniqueName - Given a base name, return a string that is either equal to -// it (or derived from it) that does not already occur in the symbol table for -// the specified type. -// -std::string SymbolTable::getUniqueName(const Type *Ty, - const std::string &BaseName) const { - // Find the plane - plane_const_iterator PI = pmap.find(Ty); - if (PI == pmap.end()) return BaseName; - - std::string TryName = BaseName; - const ValueMap& vmap = PI->second; - value_const_iterator End = vmap.end(); - - // See if the name exists - while (vmap.find(TryName) != End) // Loop until we find a free - TryName = BaseName + utostr(++LastUnique); // name in the symbol table - return TryName; -} - - -// lookup a value - Returns null on failure... -Value *SymbolTable::lookup(const Type *Ty, const std::string &Name) const { - plane_const_iterator PI = pmap.find(Ty); - if (PI != pmap.end()) { // We have symbols in that plane. - value_const_iterator VI = PI->second.find(Name); - if (VI != PI->second.end()) // and the name is in our hash table. - return VI->second; - } - return 0; -} - - -/// changeName - Given a value with a non-empty name, remove its existing entry -/// from the symbol table and insert a new one for Name. This is equivalent to -/// doing "remove(V), V->Name = Name, insert(V)", but is faster, and will not -/// temporarily remove the symbol table plane if V is the last value in the -/// symtab with that name (which could invalidate iterators to that plane). -void SymbolTable::changeName(Value *V, const std::string &name) { - assert(!V->getName().empty() && !name.empty() && V->getName() != name && - "Illegal use of this method!"); - - plane_iterator PI = pmap.find(V->getType()); - assert(PI != pmap.end() && "Value doesn't have an entry in this table?"); - ValueMap &VM = PI->second; - - value_iterator VI = VM.find(V->getName()); - assert(VI != VM.end() && "Value does have an entry in this table?"); - - // Remove the old entry. - VM.erase(VI); - - // See if we can insert the new name. - VI = VM.lower_bound(name); - - // Is there a naming conflict? - if (VI != VM.end() && VI->first == name) { - V->Name = getUniqueName(V->getType(), name); - VM.insert(make_pair(V->Name, V)); - } else { - V->Name = name; - VM.insert(VI, make_pair(name, V)); - } -} - -// Remove a value -void SymbolTable::remove(Value *N) { - assert(N->hasName() && "Value doesn't have name!"); - - plane_iterator PI = pmap.find(N->getType()); - assert(PI != pmap.end() && - "Trying to remove a value that doesn't have a type plane yet!"); - ValueMap &VM = PI->second; - value_iterator Entry = VM.find(N->getName()); - assert(Entry != VM.end() && "Invalid entry to remove!"); - -#if DEBUG_SYMBOL_TABLE - dump(); - DOUT << " Removing Value: " << Entry->second->getName() << "\n"; -#endif - - // Remove the value from the plane... - VM.erase(Entry); - - // If the plane is empty, remove it now! - if (VM.empty()) { - // If the plane represented an abstract type that we were interested in, - // unlink ourselves from this plane. - // - if (N->getType()->isAbstract()) { -#if DEBUG_ABSTYPE - DOUT << "Plane Empty: Removing type: " - << N->getType()->getDescription() << "\n"; -#endif - cast(N->getType())->removeAbstractTypeUser(this); - } - - pmap.erase(PI); - } -} - - -// insertEntry - Insert a value into the symbol table with the specified name. -void SymbolTable::insertEntry(const std::string &Name, const Type *VTy, - Value *V) { - plane_iterator PI = pmap.find(VTy); // Plane iterator - value_iterator VI; // Actual value iterator - ValueMap *VM; // The plane we care about. - -#if DEBUG_SYMBOL_TABLE - dump(); - DOUT << " Inserting definition: " << Name << ": " - << VTy->getDescription() << "\n"; -#endif - - if (PI == pmap.end()) { // Not in collection yet... insert dummy entry - // Insert a new empty element. I points to the new elements. - VM = &pmap.insert(make_pair(VTy, ValueMap())).first->second; - VI = VM->end(); - - // Check to see if the type is abstract. If so, it might be refined in the - // future, which would cause the plane of the old type to get merged into - // a new type plane. - // - if (VTy->isAbstract()) { - cast(VTy)->addAbstractTypeUser(this); -#if DEBUG_ABSTYPE - DOUT << "Added abstract type value: " << VTy->getDescription() - << "\n"; -#endif - } - - } else { - // Check to see if there is a naming conflict. If so, rename this value! - VM = &PI->second; - VI = VM->lower_bound(Name); - if (VI != VM->end() && VI->first == Name) { - V->Name = getUniqueName(VTy, Name); - VM->insert(make_pair(V->Name, V)); - return; - } - } - - VM->insert(VI, make_pair(Name, V)); -} - - - -// Strip the symbol table of its names. -bool SymbolTable::strip() { - bool RemovedSymbol = false; - for (plane_iterator I = pmap.begin(); I != pmap.end();) { - // Removing items from the plane can cause the plane itself to get deleted. - // If this happens, make sure we incremented our plane iterator already! - ValueMap &Plane = (I++)->second; - value_iterator B = Plane.begin(), Bend = Plane.end(); - while (B != Bend) { // Found nonempty type plane! - Value *V = B->second; - ++B; - if (!isa(V) || cast(V)->hasInternalLinkage()) { - // Set name to "", removing from symbol table! - V->setName(""); - RemovedSymbol = true; - } - } - } - - return RemovedSymbol; -} - - -// This function is called when one of the types in the type plane are refined -void SymbolTable::refineAbstractType(const DerivedType *OldType, - const Type *NewType) { - - // Search to see if we have any values of the type Oldtype. If so, we need to - // move them into the newtype plane... - plane_iterator PI = pmap.find(OldType); - if (PI != pmap.end()) { - // Get a handle to the new type plane... - plane_iterator NewTypeIt = pmap.find(NewType); - if (NewTypeIt == pmap.end()) { // If no plane exists, add one - NewTypeIt = pmap.insert(make_pair(NewType, ValueMap())).first; - - if (NewType->isAbstract()) { - cast(NewType)->addAbstractTypeUser(this); -#if DEBUG_ABSTYPE - DOUT << "[Added] refined to abstype: " << NewType->getDescription() - << "\n"; -#endif - } - } - - ValueMap &NewPlane = NewTypeIt->second; - ValueMap &OldPlane = PI->second; - while (!OldPlane.empty()) { - std::pair V = *OldPlane.begin(); - - // Check to see if there is already a value in the symbol table that this - // would collide with. - value_iterator VI = NewPlane.find(V.first); - if (VI != NewPlane.end() && VI->second == V.second) { - // No action - - } else if (VI != NewPlane.end()) { - // The only thing we are allowing for now is two external global values - // folded into one. - // - GlobalValue *ExistGV = dyn_cast(VI->second); - GlobalValue *NewGV = dyn_cast(V.second); - - if (ExistGV && NewGV) { - assert((ExistGV->isDeclaration() || NewGV->isDeclaration()) && - "Two planes folded together with overlapping value names!"); - - // Make sure that ExistGV is the one we want to keep! - if (!NewGV->isDeclaration()) - std::swap(NewGV, ExistGV); - - // Ok we have two external global values. Make all uses of the new - // one use the old one... - NewGV->uncheckedReplaceAllUsesWith(ExistGV); - - // Update NewGV's name, we're about the remove it from the symbol - // table. - NewGV->Name = ""; - - // Now we can remove this global from the module entirely... - Module *M = NewGV->getParent(); - if (Function *F = dyn_cast(NewGV)) - M->getFunctionList().remove(F); - else - M->getGlobalList().remove(cast(NewGV)); - delete NewGV; - } else { - // If they are not global values, they must be just random values who - // happen to conflict now that types have been resolved. If this is - // the case, reinsert the value into the new plane, allowing it to get - // renamed. - assert(V.second->getType() == NewType &&"Type resolution is broken!"); - insert(V.second); - } - } else { - insertEntry(V.first, NewType, V.second); - } - // Remove the item from the old type plane - OldPlane.erase(OldPlane.begin()); - } - - // Ok, now we are not referencing the type anymore... take me off your user - // list please! -#if DEBUG_ABSTYPE - DOUT << "Removing type " << OldType->getDescription() << "\n"; -#endif - OldType->removeAbstractTypeUser(this); - - // Remove the plane that is no longer used - pmap.erase(PI); - } -} - - -// Handle situation where type becomes Concreate from Abstract -void SymbolTable::typeBecameConcrete(const DerivedType *AbsTy) { - plane_iterator PI = pmap.find(AbsTy); - - // If there are any values in the symbol table of this type, then the type - // plane is a use of the abstract type which must be dropped. - if (PI != pmap.end()) - AbsTy->removeAbstractTypeUser(this); -} - -static void DumpVal(const std::pair &V) { - DOUT << " '" << V.first << "' = "; - V.second->dump(); - DOUT << "\n"; -} - -static void DumpPlane(const std::pair >&P){ - P.first->dump(); - DOUT << "\n"; - for_each(P.second.begin(), P.second.end(), DumpVal); -} - -void SymbolTable::dump() const { - DOUT << "Symbol table dump:\n Plane:"; - for_each(pmap.begin(), pmap.end(), DumpPlane); -} - -// vim: sw=2 ai diff --git a/llvm/lib/VMCore/SymbolTableListTraitsImpl.h b/llvm/lib/VMCore/SymbolTableListTraitsImpl.h index 81849dd031987d7a86e6a3fad5a41b4bdc36495d..f4ee13f108f4a5f79c3547eb0e24a0d66adac0f6 100644 --- a/llvm/lib/VMCore/SymbolTableListTraitsImpl.h +++ b/llvm/lib/VMCore/SymbolTableListTraitsImpl.h @@ -17,7 +17,7 @@ #define LLVM_SYMBOLTABLELISTTRAITS_IMPL_H #include "llvm/SymbolTableListTraits.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" namespace llvm { @@ -29,7 +29,7 @@ void SymbolTableListTraits // Remove all of the items from the old symtab.. if (SymTabObject && !List.empty()) { - SymbolTable &SymTab = SymTabObject->getValueSymbolTable(); + ValueSymbolTable &SymTab = SymTabObject->getValueSymbolTable(); for (typename iplist::iterator I = List.begin(); I != List.end(); ++I) if (I->hasName()) SymTab.remove(I); @@ -39,7 +39,7 @@ void SymbolTableListTraits // Add all of the items to the new symtab... if (SymTabObject && !List.empty()) { - SymbolTable &SymTab = SymTabObject->getValueSymbolTable(); + ValueSymbolTable &SymTab = SymTabObject->getValueSymbolTable(); for (typename iplist::iterator I = List.begin(); I != List.end(); ++I) if (I->hasName()) SymTab.insert(I); diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp index 3733d2a7ba33f0d928d13f7231b2d5a823fa18fd..a6e57971bd5a463bc095e060e8ddfb86ac3dfec0 100644 --- a/llvm/lib/VMCore/Type.cpp +++ b/llvm/lib/VMCore/Type.cpp @@ -13,7 +13,6 @@ #include "llvm/AbstractTypeUser.h" #include "llvm/DerivedTypes.h" -#include "llvm/SymbolTable.h" #include "llvm/Constants.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/StringExtras.h" diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp index 94c03b834ada23516828eb76227031f7afec7948..0218e5798fad37e351d81bdb8371357e6cdb42b5 100644 --- a/llvm/lib/VMCore/Value.cpp +++ b/llvm/lib/VMCore/Value.cpp @@ -15,7 +15,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/InstrTypes.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Support/Debug.h" #include "llvm/Support/LeakDetector.h" #include @@ -97,17 +97,20 @@ void Value::setName(const std::string &name) { if (Name == name) return; // Name is already set. // Get the symbol table to update for this object. - SymbolTable *ST = 0; + ValueSymbolTable *ST = 0; if (Instruction *I = dyn_cast(this)) { if (BasicBlock *P = I->getParent()) if (Function *PP = P->getParent()) ST = &PP->getValueSymbolTable(); } else if (BasicBlock *BB = dyn_cast(this)) { - if (Function *P = BB->getParent()) ST = &P->getValueSymbolTable(); + if (Function *P = BB->getParent()) + ST = &P->getValueSymbolTable(); } else if (GlobalValue *GV = dyn_cast(this)) { - if (Module *P = GV->getParent()) ST = &P->getValueSymbolTable(); + if (Module *P = GV->getParent()) + ST = &P->getValueSymbolTable(); } else if (Argument *A = dyn_cast(this)) { - if (Function *P = A->getParent()) ST = &P->getValueSymbolTable(); + if (Function *P = A->getParent()) + ST = &P->getValueSymbolTable(); } else { assert(isa(this) && "Unknown value type!"); return; // no name is setable for this. @@ -117,7 +120,7 @@ void Value::setName(const std::string &name) { Name = name; else if (hasName()) { if (!name.empty()) { // Replacing name. - ST->changeName(this, name); + ST->rename(this, name); } else { // Transitioning from hasName -> noname. ST->remove(this); Name.clear(); diff --git a/llvm/lib/VMCore/ValueSymbolTable.cpp b/llvm/lib/VMCore/ValueSymbolTable.cpp index 6efb9983874ef087f91f5ae2dc262bd36968556c..51197b6bf3cef56ddbb17c763a03fa20527bc279 100644 --- a/llvm/lib/VMCore/ValueSymbolTable.cpp +++ b/llvm/lib/VMCore/ValueSymbolTable.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "valuesymtab" #include "llvm/GlobalValue.h" #include "llvm/Type.h" #include "llvm/ValueSymbolTable.h" @@ -19,18 +20,15 @@ #include using namespace llvm; -#define DEBUG_SYMBOL_TABLE 0 -#define DEBUG_ABSTYPE 0 - // Class destructor ValueSymbolTable::~ValueSymbolTable() { #ifndef NDEBUG // Only do this in -g mode... bool LeftoverValues = true; for (iterator VI = vmap.begin(), VE = vmap.end(); VI != VE; ++VI) if (!isa(VI->second) ) { - DOUT << "Value still in symbol table! Type = '" + DEBUG(DOUT << "Value still in symbol table! Type = '" << VI->second->getType()->getDescription() << "' Name = '" - << VI->first << "'\n"; + << VI->first << "'\n"); LeftoverValues = false; } assert(LeftoverValues && "Values remain in symbol table!"); @@ -83,29 +81,24 @@ void ValueSymbolTable::insert(Value* V) { assert(V && "Can't insert null Value into symbol table!"); assert(V->hasName() && "Can't insert nameless Value into symbol table"); - // Check to see if there is a naming conflict. If so, rename this type! + // Check to see if there is a naming conflict. If so, rename this value std::string UniqueName = getUniqueName(V->getName()); -#if DEBUG_SYMBOL_TABLE - dump(); - DOUT << " Inserting value: " << UniqueName << ": " << V->dump() << "\n"; -#endif + DEBUG(DOUT << " Inserting value: " << UniqueName << ": " << *V << "\n"); // Insert the vmap entry - vmap.insert(make_pair(UniqueName, V)); + V->Name = UniqueName; + vmap.insert(make_pair(V->Name, V)); } // Remove a value -bool ValueSymbolTable::erase(Value *V) { +bool ValueSymbolTable::remove(Value *V) { assert(V->hasName() && "Value doesn't have name!"); iterator Entry = vmap.find(V->getName()); if (Entry == vmap.end()) return false; -#if DEBUG_SYMBOL_TABLE - dump(); - DOUT << " Removing Value: " << Entry->second->getName() << "\n"; -#endif + DEBUG(DOUT << " Removing Value: " << Entry->second->getName() << "\n"); // Remove the value from the plane... vmap.erase(Entry); @@ -143,7 +136,7 @@ bool ValueSymbolTable::rename(Value *V, const std::string &name) { vmap.insert(make_pair(V->Name, V)); } else { V->Name = name; - vmap.insert(VI, make_pair(name, V)); + vmap.insert(VI, make_pair(V->Name, V)); } return true; diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 9dc892e5aeffde3c97c9ed8ce97dc7ecf5db9f25..f5b0550d88ea3f1097cad2c324096393ca14cfd7 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -51,7 +51,7 @@ #include "llvm/Instructions.h" #include "llvm/Intrinsics.h" #include "llvm/PassManager.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Support/CFG.h" #include "llvm/Support/InstVisitor.h" @@ -175,7 +175,7 @@ namespace { // Anonymous namespace for class // Verification methods... void verifyTypeSymbolTable(TypeSymbolTable &ST); - void verifyValueSymbolTable(SymbolTable &ST); + void verifyValueSymbolTable(ValueSymbolTable &ST); void visitGlobalValue(GlobalValue &GV); void visitGlobalVariable(GlobalVariable &GV); void visitFunction(Function &F); @@ -307,20 +307,18 @@ void Verifier::verifyTypeSymbolTable(TypeSymbolTable &ST) { // verifySymbolTable - Verify that a function or module symbol table is ok // -void Verifier::verifyValueSymbolTable(SymbolTable &ST) { - - // Loop over all of the values in all type planes in the symbol table. - for (SymbolTable::plane_const_iterator PI = ST.plane_begin(), - PE = ST.plane_end(); PI != PE; ++PI) - for (SymbolTable::value_const_iterator VI = PI->second.begin(), - VE = PI->second.end(); VI != VE; ++VI) { - Value *V = VI->second; - // Check that there are no void typed values in the symbol table. Values - // with a void type cannot be put into symbol tables because they cannot - // have names! - Assert1(V->getType() != Type::VoidTy, - "Values with void type are not allowed to have names!", V); - } +void Verifier::verifyValueSymbolTable(ValueSymbolTable &ST) { + + // Loop over all of the values in the symbol table. + for (ValueSymbolTable::const_iterator VI = ST.begin(), VE = ST.end(); + VI != VE; ++VI) { + Value *V = VI->second; + // Check that there are no void typed values in the symbol table. Values + // with a void type cannot be put into symbol tables because they cannot + // have names! + Assert1(V->getType() != Type::VoidTy, + "Values with void type are not allowed to have names!", V); + } } // visitFunction - Verify that a function is ok. diff --git a/llvm/test/Integer/calltest_bt.ll b/llvm/test/Integer/calltest_bt.ll index c4a7f63fe4ccc634f0145a795402c5c0db73e587..ac0c79563c2be9b705dad17488c5df09f46c1c8b 100644 --- a/llvm/test/Integer/calltest_bt.ll +++ b/llvm/test/Integer/calltest_bt.ll @@ -5,7 +5,6 @@ %FunTy = type i28(i28) declare i28 @"test"(...) ; Test differences of prototype -declare i28 @"test"() ; Differ only by vararg implementation @@ -17,18 +16,18 @@ define void @"invoke"(%FunTy *%x) { define i28 @"main"(i28 %argc) ; TODO: , sbyte **argv, sbyte **envp) begin - %retval = call i28 (i28) *@test(i28 %argc) + %retval = call i28 (i28) *@test2(i28 %argc) %two = add i28 %retval, %retval - %retval2 = invoke i28 @test(i28 %argc) + %retval2 = invoke i28 @test2(i28 %argc) to label %Next unwind label %Error Next: %two2 = add i28 %two, %retval2 - call void @invoke (%FunTy* @test) + call void @invoke (%FunTy* @test2) ret i28 %two2 Error: ret i28 -1 end -define i28 @"test"(i28 %i0) { +define i28 @"test2"(i28 %i0) { ret i28 %i0 } diff --git a/llvm/test/Linker/redefinition.ll b/llvm/test/Linker/redefinition.ll new file mode 100644 index 0000000000000000000000000000000000000000..ae2dc624756a33f6a97b38f690045e9f4e7a56af --- /dev/null +++ b/llvm/test/Linker/redefinition.ll @@ -0,0 +1,10 @@ +; Test linking two functions with different prototypes and two globals +; in different modules. +; RUN: llvm-as %s -o %t.foo1.bc -f +; RUN: llvm-as %s -o %t.foo2.bc -f +; RUN: echo "define void @foo(i32 %x) { ret void }" | llvm-as -o %t.foo3.bc -f +; RUN: llvm-link %t.foo1.bc %t.foo2.bc -o %t.bc 2>&1 | \ +; RUN: grep "Function is already defined" +; RUN: llvm-link %t.foo1.bc %t.foo3.bc -o %t.bc 2>&1 | \ +; RUN: grep "Function 'foo' defined as both" +define void @foo() { ret void } diff --git a/llvm/test/Transforms/FunctionResolve/.cvsignore b/llvm/test/Transforms/FunctionResolve/.cvsignore deleted file mode 100644 index 7f2443f2f31aa8a2e7b0e7cb326ac01d8049f9f5..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Output -*.log -*.sum diff --git a/llvm/test/Transforms/FunctionResolve/2002-08-19-ResolveGlobalVars.ll b/llvm/test/Transforms/FunctionResolve/2002-08-19-ResolveGlobalVars.ll deleted file mode 100644 index 427227aeb3e584c70edce206a732643a6767215c..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2002-08-19-ResolveGlobalVars.ll +++ /dev/null @@ -1,18 +0,0 @@ -; Test that: extern int X[] and int X[] = { 1, 2, 3, 4 } are resolved -; correctly. -; -; RUN: llvm-as < %s | opt -funcresolve | llvm-dis | not grep external - -@X = external global [0 x int] -@X = global [4 x int] [ int 1, int 2, int 3, int 4 ] - -implementation ; Functions: - -int @foo(int %x) { -bb1: ;[#uses=0] - store int 5, int* getelementptr ([0 x int]* @X, long 0, long 2) - %F = getelementptr [0 x int]* @X, long 0, long 2 - %val = load int* %F - ret int %val -} - diff --git a/llvm/test/Transforms/FunctionResolve/2002-08-19-ResolveGlobalVarsEasier.ll b/llvm/test/Transforms/FunctionResolve/2002-08-19-ResolveGlobalVarsEasier.ll deleted file mode 100644 index 188fc95b12d15cb92fe7402484990a2faa586ce1..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2002-08-19-ResolveGlobalVarsEasier.ll +++ /dev/null @@ -1,20 +0,0 @@ -; Test that: extern int X[] and int X[] = { 1, 2, 3, 4 } are resolved -; correctly. This doesn't have constantexprs -; -; RUN: llvm-as < %s | opt -funcresolve | llvm-dis | not grep external -; - -@X = external global [0 x int] -@X = global [4 x int] [ int 1, int 2, int 3, int 4 ] - -implementation ; Functions: - -int %foo(int %x) { -bb1: ;[#uses=0] - %G = getelementptr [0 x int]* @X, long 0, long 1 - store int 5, int* %G - %F = getelementptr [0 x int]* @X, long 0, long 2 - %val = load int* %F - ret int %val -} - diff --git a/llvm/test/Transforms/FunctionResolve/2002-11-07-RetMismatch.ll b/llvm/test/Transforms/FunctionResolve/2002-11-07-RetMismatch.ll deleted file mode 100644 index 2ca82686fb6a65e40e6bc0fa99024d9034628d09..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2002-11-07-RetMismatch.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve -funcresolve | llvm-dis | not grep declare - -declare void %qsortg(sbyte*, int, int) - -void %test() { - call void %qsortg(sbyte* null, int 0, int 0) - ret void -} - -int %qsortg(sbyte* %base, int %n, int %size) { - ret int %n -} diff --git a/llvm/test/Transforms/FunctionResolve/2002-11-09-ExternFn.ll b/llvm/test/Transforms/FunctionResolve/2002-11-09-ExternFn.ll deleted file mode 100644 index d5eb0ca9b3bedeb8dfc084128e073c7a8dd90993..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2002-11-09-ExternFn.ll +++ /dev/null @@ -1,11 +0,0 @@ -; XFAIL: * -; -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve -instcombine | llvm-dis | not grep '\.\.\.' - -declare int %foo(...) -declare int %foo(int) - -void %bar() { - call int(...)* %foo(int 7) - ret void -} diff --git a/llvm/test/Transforms/FunctionResolve/2003-04-18-ForwardDeclGlobal.ll b/llvm/test/Transforms/FunctionResolve/2003-04-18-ForwardDeclGlobal.ll deleted file mode 100644 index 663d3eb18f998579e24043995e244624e6e9bb35..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2003-04-18-ForwardDeclGlobal.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve -disable-output 2>&1 | not grep WARNING - -%__popcount_tab = external constant [0 x ubyte] -%__popcount_tab = constant [4 x ubyte] c"\00\01\01\02" - -declare void %foo(ubyte *) - -void %test() { - getelementptr [0 x ubyte]* %__popcount_tab, long 0, long 2 - getelementptr [4 x ubyte]* %__popcount_tab, long 0, long 2 - call void %foo(ubyte * getelementptr ([0 x ubyte]* %__popcount_tab, long 0, long 2)) - ret void -} - diff --git a/llvm/test/Transforms/FunctionResolve/2003-05-21-MissingArguments.ll b/llvm/test/Transforms/FunctionResolve/2003-05-21-MissingArguments.ll deleted file mode 100644 index b54d595c5f741762d31707c666d0b1c913117502..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2003-05-21-MissingArguments.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve -disable-output - -void %foo(int, int) { - ret void -} -declare void %foo(...) - -void %test() { - call void(...)* %foo(int 7) - ret void -} diff --git a/llvm/test/Transforms/FunctionResolve/2003-05-31-AllInternalDecls.ll b/llvm/test/Transforms/FunctionResolve/2003-05-31-AllInternalDecls.ll deleted file mode 100644 index 7abf0c2ce49fe404441ef4503fbe53579d8d098c..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2003-05-31-AllInternalDecls.ll +++ /dev/null @@ -1,7 +0,0 @@ -; This testcase should not cause a warning! - -; RUN: (as < %s | opt -funcresolve -disable-output) 2>&1 | not grep 'WARNING' - -%X = internal global float 1.0 -%X = internal global int 1 - diff --git a/llvm/test/Transforms/FunctionResolve/2003-05-31-FuncPointerResolve.ll b/llvm/test/Transforms/FunctionResolve/2003-05-31-FuncPointerResolve.ll deleted file mode 100644 index 51b00010232d51c8ce8d5b95479e5e337921ba38..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2003-05-31-FuncPointerResolve.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve | llvm-dis | not grep declare - -%Table = constant int(...)* %foo - -%Table2 = constant [1 x int(...)* ] [ int(...)* %foo ] - -declare int %foo(...) - -int %foo() { - ret int 0 -} diff --git a/llvm/test/Transforms/FunctionResolve/2003-05-31-InternalDecl.ll b/llvm/test/Transforms/FunctionResolve/2003-05-31-InternalDecl.ll deleted file mode 100644 index c8d2de6d230a01bd67edfcd7731a5294a5ebd1ee..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2003-05-31-InternalDecl.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve | llvm-dis | grep declare - -declare void %test(...) - -int %callee() { - call void(...)* %test(int 5) - ret int 2 -} - -internal void %test(int) { - ret void -} diff --git a/llvm/test/Transforms/FunctionResolve/2003-06-18-TypePromotion.ll b/llvm/test/Transforms/FunctionResolve/2003-06-18-TypePromotion.ll deleted file mode 100644 index 9c22cbfca3be65ae4f7faf337ac11cfe9fdef134..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2003-06-18-TypePromotion.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve | dis | not grep declare - -declare void %test(int) - -int %callee(int %X) { - call void %test(int %X) - ret int 2 -} - -internal void %test(sbyte) { - ret void -} diff --git a/llvm/test/Transforms/FunctionResolve/2003-07-23-CPR-Reference.ll b/llvm/test/Transforms/FunctionResolve/2003-07-23-CPR-Reference.ll deleted file mode 100644 index e1a29ec28246f1ca5a0eb1a2410b92a1839aa04c..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2003-07-23-CPR-Reference.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve | llvm-dis | not grep foo - -; The funcresolve pass was resolving the two foo's together in this test, -; adding a ConstantPointerRef to one of them. Then because of this -; reference, it wasn't able to delete the dead declaration. :( - -declare int %foo(...) -declare int %foo(int) - - diff --git a/llvm/test/Transforms/FunctionResolve/2003-08-23-ArgumentWarning.ll b/llvm/test/Transforms/FunctionResolve/2003-08-23-ArgumentWarning.ll deleted file mode 100644 index 4e0a4aff9dbc5950d13b810433d628d3082de75d..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2003-08-23-ArgumentWarning.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve -disable-output 2>&1 | not grep WARNING - -declare int %foo(int *%X) -declare int %foo(float *%X) - -implementation - -void %test() { - call int %foo(int* null) - call int %foo(float* null) - ret void -} diff --git a/llvm/test/Transforms/FunctionResolve/2003-10-21-GlobalResolveHack.ll b/llvm/test/Transforms/FunctionResolve/2003-10-21-GlobalResolveHack.ll deleted file mode 100644 index df5340f46a2f1df09fb92fbc56c5f05701cf2b29..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2003-10-21-GlobalResolveHack.ll +++ /dev/null @@ -1,12 +0,0 @@ -; This tests a hack put into place specifically for the C++ libstdc++ library. -; It uses an ugly hack which is cleaned up by the funcresolve pass. -; -; RUN: llvm-as < %s | opt -funcresolve | llvm-dis | grep @X | grep '{' - -@X = external global { i32 } -@X = global [ 4 x i8 ] zeroinitializer - -define i32* @test() { - %P = getelementptr {i32}* @X, i64 0, i32 0 - ret i32* %P -} diff --git a/llvm/test/Transforms/FunctionResolve/2003-11-20-BogusResolveWarning.ll b/llvm/test/Transforms/FunctionResolve/2003-11-20-BogusResolveWarning.ll deleted file mode 100644 index cc481f5143ce5671c712012938a3ec9d69bf8e1f..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/2003-11-20-BogusResolveWarning.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve -disable-output 2>&1 | not grep WARNING - - -void %test() { - call int(...)* %test() - ret void -} - -declare int %test(...) - diff --git a/llvm/test/Transforms/FunctionResolve/basictest.ll b/llvm/test/Transforms/FunctionResolve/basictest.ll deleted file mode 100644 index 866ae8e54b561dc45d9964fcb1615d8f927c4daf..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/basictest.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve -instcombine | llvm-dis | grep '\.\.\.' | not grep call - -declare int %foo(...) - -int %foo(int %x, float %y) { - ret int %x -} - -int %bar() { - %x = call int(...)* %foo(double 12.5, int 48) - ret int %x -} diff --git a/llvm/test/Transforms/FunctionResolve/dg.exp b/llvm/test/Transforms/FunctionResolve/dg.exp deleted file mode 100644 index 142de8a6c8f654b3e491cc659e617b7bdb81c1da..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm-dg.exp - -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext $llvmgcc_version diff --git a/llvm/test/Transforms/FunctionResolve/retmismatch1.ll b/llvm/test/Transforms/FunctionResolve/retmismatch1.ll deleted file mode 100644 index 51aeff851c9705adbcc02c521771d7db3a1b715b..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/retmismatch1.ll +++ /dev/null @@ -1,14 +0,0 @@ -; This shows where the function is called with the prototype indicating a -; return type exists, but it really doesn't. -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve -instcombine | llvm-dis | grep '\.\.\.' | not grep call - -declare int %foo(...) - -void %foo(int %x, float %y) { - ret void -} - -int %bar() { - %x = call int(...)* %foo(double 12.5, int 48) - ret int %x -} diff --git a/llvm/test/Transforms/FunctionResolve/retmismatch2.ll b/llvm/test/Transforms/FunctionResolve/retmismatch2.ll deleted file mode 100644 index 749ca40db821040879dd95a76050ce103f7e83b5..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/retmismatch2.ll +++ /dev/null @@ -1,15 +0,0 @@ -; This shows where the function is called with the prototype indicating a -; return type doesn't exists, but it really does. -; -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve -instcombine | llvm-dis | grep '\.\.\.' | not grep call - -declare void %foo(...) - -int %foo(int %x, float %y) { - ret int %x -} - -int %bar() { - call void (...)* %foo(double 12.5, int 48) - ret int 6 -} diff --git a/llvm/test/Transforms/FunctionResolve/retmismatch3.ll b/llvm/test/Transforms/FunctionResolve/retmismatch3.ll deleted file mode 100644 index f9850d67a7d4230a8a538dbaf161730f6156ef87..0000000000000000000000000000000000000000 --- a/llvm/test/Transforms/FunctionResolve/retmismatch3.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -funcresolve - -declare int %read(...) - -long %read() { - ret long 0 -} - -int %testfunc() { - %X = call int(...)* %read() - ret int %X -} diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp index 66b6511067377d7b4e7e2512087c70bf7b09893e..b597d8256d5a52b8c017e6eef83e41bcf29f4a73 100644 --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/llvm/tools/bugpoint/CrashDebugger.cpp @@ -20,7 +20,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/PassManager.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Bytecode/Writer.h" #include "llvm/Support/CFG.h" @@ -206,9 +206,9 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) { // FIXME: bugpoint should add names to all stripped symbols. assert(!Funcs[i]->getName().empty() && "Bugpoint doesn't work on stripped modules yet PR718!"); - Function *CMF = M->getFunction(Funcs[i]->getName(), - Funcs[i]->getFunctionType()); + Function *CMF = M->getFunction(Funcs[i]->getName()); assert(CMF && "Function not in module?!"); + assert(CMF->getFunctionType() == Funcs[i]->getFunctionType() && "wrong ty"); Functions.insert(CMF); } @@ -271,8 +271,9 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector &BBs) { for (unsigned i = 0, e = BBs.size(); i != e; ++i) { // Convert the basic block from the original module to the new module... const Function *F = BBs[i]->getParent(); - Function *CMF = M->getFunction(F->getName(), F->getFunctionType()); + Function *CMF = M->getFunction(F->getName()); assert(CMF && "Function not in module?!"); + assert(CMF->getFunctionType() == F->getFunctionType() && "wrong type?"); // Get the mapped basic block... Function::iterator CBI = CMF->begin(); @@ -337,10 +338,10 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector &BBs) { // module, and that they don't include any deleted blocks. BBs.clear(); for (unsigned i = 0, e = BlockInfo.size(); i != e; ++i) { - SymbolTable &ST = BlockInfo[i].first->getValueSymbolTable(); - SymbolTable::plane_iterator PI = ST.find(Type::LabelTy); - if (PI != ST.plane_end() && PI->second.count(BlockInfo[i].second)) - BBs.push_back(cast(PI->second[BlockInfo[i].second])); + ValueSymbolTable &ST = BlockInfo[i].first->getValueSymbolTable(); + Value* V = ST.lookup(BlockInfo[i].second); + if (V && V->getType() == Type::LabelTy) + BBs.push_back(cast(V)); } return true; } diff --git a/llvm/tools/bugpoint/ExtractFunction.cpp b/llvm/tools/bugpoint/ExtractFunction.cpp index b9d43e897187a10ab04241e9c7be55897af0149b..1ff06f88b1c1c536735cbbc22c899d13f7859e0c 100644 --- a/llvm/tools/bugpoint/ExtractFunction.cpp +++ b/llvm/tools/bugpoint/ExtractFunction.cpp @@ -110,7 +110,6 @@ Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) { I->setLinkage(GlobalValue::ExternalLinkage); std::vector CleanupPasses; - CleanupPasses.push_back(getPI(createFunctionResolvingPass())); CleanupPasses.push_back(getPI(createGlobalDCEPass())); CleanupPasses.push_back(getPI(createDeadTypeEliminationPass())); @@ -221,7 +220,7 @@ static void SplitStaticCtorDtor(const char *GlobalName, Module *M1, Module *M2){ M1Tors.push_back(std::make_pair(F, Priority)); else { // Map to M2's version of the function. - F = M2->getFunction(F->getName(), F->getFunctionType()); + F = M2->getFunction(F->getName()); M2Tors.push_back(std::make_pair(F, Priority)); } } @@ -272,9 +271,10 @@ Module *llvm::SplitFunctionsOutOfModule(Module *M, std::set > TestFunctions; for (unsigned i = 0, e = F.size(); i != e; ++i) { TestFunctions.insert(std::make_pair(F[i]->getName(), F[i]->getType())); - Function *TNOF = M->getFunction(F[i]->getName(), F[i]->getFunctionType()); - DEBUG(std::cerr << "Removing function " << F[i]->getName() << "\n"); + Function *TNOF = M->getFunction(F[i]->getName()); assert(TNOF && "Function doesn't exist in module!"); + assert(TNOF->getFunctionType() == F[i]->getFunctionType() && "wrong type?"); + DEBUG(std::cerr << "Removing function " << F[i]->getName() << "\n"); DeleteFunctionBody(TNOF); // Function is now external in this module! } @@ -317,7 +317,7 @@ bool BlockExtractorPass::runOnModule(Module &M) { Function *F = BB->getParent(); // Map the corresponding function in this module. - Function *MF = M.getFunction(F->getName(), F->getFunctionType()); + Function *MF = M.getFunction(F->getName()); // Figure out which index the basic block is in its function. Function::iterator BBI = MF->begin(); diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp index bdbd11ba1543cec28ab0c89869b0697110a5d1e4..38ccf0bc562d43a1353cb984a22d3673c13fc7e5 100644 --- a/llvm/tools/bugpoint/Miscompilation.cpp +++ b/llvm/tools/bugpoint/Miscompilation.cpp @@ -341,9 +341,11 @@ static bool ExtractLoops(BugDriver &BD, // optimized and loop extracted module. MiscompiledFunctions.clear(); for (unsigned i = 0, e = MisCompFunctions.size(); i != e; ++i) { - Function *NewF = ToNotOptimize->getFunction(MisCompFunctions[i].first, - MisCompFunctions[i].second); + Function *NewF = ToNotOptimize->getFunction(MisCompFunctions[i].first); + assert(NewF && "Function not found??"); + assert(NewF->getFunctionType() == MisCompFunctions[i].second && + "found wrong function type?"); MiscompiledFunctions.push_back(NewF); } @@ -479,9 +481,10 @@ static bool ExtractBlocks(BugDriver &BD, MiscompiledFunctions.clear(); for (unsigned i = 0, e = MisCompFunctions.size(); i != e; ++i) { - Function *NewF = ProgClone->getFunction(MisCompFunctions[i].first, - MisCompFunctions[i].second); + Function *NewF = ProgClone->getFunction(MisCompFunctions[i].first); assert(NewF && "Function not found??"); + assert(NewF->getFunctionType() == MisCompFunctions[i].second && + "Function has wrong type??"); MiscompiledFunctions.push_back(NewF); } diff --git a/llvm/tools/gccld/GenerateCode.cpp b/llvm/tools/gccld/GenerateCode.cpp index e70bda307a718af2b683f91cc0b98c6ce5f73a2b..3f9923cd1b76936d55cc3c2b859bef4f0200484f 100644 --- a/llvm/tools/gccld/GenerateCode.cpp +++ b/llvm/tools/gccld/GenerateCode.cpp @@ -212,12 +212,6 @@ int llvm::GenerateBytecode(Module *M, int StripLevel, bool Internalize, // Add an appropriate TargetData instance for this module... addPass(Passes, new TargetData(M)); - // Often if the programmer does not specify proper prototypes for the - // functions they are calling, they end up calling a vararg version of the - // function that does not get a body filled in (the real function has typed - // arguments). This pass merges the two functions. - addPass(Passes, createFunctionResolvingPass()); - if (!DisableOptimizations) { // Now that composite has been compiled, scan through the module, looking // for a main function. If main is defined, mark all other functions diff --git a/llvm/tools/llvm-extract/llvm-extract.cpp b/llvm/tools/llvm-extract/llvm-extract.cpp index 766860fd4f4a632f5b1087b182580e4c40671b35..932f19ef6064fca56381218db5175ad9badab3c5 100644 --- a/llvm/tools/llvm-extract/llvm-extract.cpp +++ b/llvm/tools/llvm-extract/llvm-extract.cpp @@ -79,7 +79,6 @@ int main(int argc, char **argv) { Passes.add(createFunctionExtractionPass(F, DeleteFn, Relink)); if (!DeleteFn) Passes.add(createGlobalDCEPass()); // Delete unreachable globals - Passes.add(createFunctionResolvingPass()); // Delete prototypes Passes.add(createDeadTypeEliminationPass()); // Remove dead types... std::ostream *Out = 0; diff --git a/llvm/tools/llvm-ld/Optimize.cpp b/llvm/tools/llvm-ld/Optimize.cpp index c0edd43efcf1279a7cc032bc23efcdc5b1ed7bcd..0f77027ef62c8ac78e5b90e217666157767e78a7 100644 --- a/llvm/tools/llvm-ld/Optimize.cpp +++ b/llvm/tools/llvm-ld/Optimize.cpp @@ -108,12 +108,6 @@ void Optimize(Module* M) { // Add an appropriate TargetData instance for this module... addPass(Passes, new TargetData(M)); - // Often if the programmer does not specify proper prototypes for the - // functions they are calling, they end up calling a vararg version of the - // function that does not get a body filled in (the real function has typed - // arguments). This pass merges the two functions. - addPass(Passes, createFunctionResolvingPass()); - if (!DisableOptimizations) { // Now that composite has been compiled, scan through the module, looking // for a main function. If main is defined, mark all other functions diff --git a/llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs b/llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs index eb32f83fd432d471b65f93488c0ba2bc554d7035..5a5f4368ed4a2340225dac648d98dc4be1bb3373 100644 --- a/llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs +++ b/llvm/tools/llvm-upgrade/UpgradeLexer.cpp.cvs @@ -925,7 +925,7 @@ goto find_rule; \ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 1 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" #define INITIAL 0 /*===-- UpgradeLexer.l - Scanner for 1.9 assembly files --------*- C++ -*--===// // @@ -940,7 +940,7 @@ char *yytext; // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#line 28 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 28 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" #include "UpgradeInternals.h" #include "llvm/Module.h" #include @@ -1227,7 +1227,7 @@ YY_DECL register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 189 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 189 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" #line 1234 "UpgradeLexer.cpp" @@ -1323,717 +1323,717 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 191 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 191 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { /* Ignore comments for now */ } YY_BREAK case 2: YY_RULE_SETUP -#line 193 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 193 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return BEGINTOK; } YY_BREAK case 3: YY_RULE_SETUP -#line 194 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 194 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return ENDTOK; } YY_BREAK case 4: YY_RULE_SETUP -#line 195 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return TRUETOK; } YY_BREAK case 5: YY_RULE_SETUP -#line 196 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 196 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return FALSETOK; } YY_BREAK case 6: YY_RULE_SETUP -#line 197 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 197 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return DECLARE; } YY_BREAK case 7: YY_RULE_SETUP -#line 198 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 198 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return GLOBAL; } YY_BREAK case 8: YY_RULE_SETUP -#line 199 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 199 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return CONSTANT; } YY_BREAK case 9: YY_RULE_SETUP -#line 200 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 200 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return INTERNAL; } YY_BREAK case 10: YY_RULE_SETUP -#line 201 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 201 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return LINKONCE; } YY_BREAK case 11: YY_RULE_SETUP -#line 202 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 202 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return WEAK; } YY_BREAK case 12: YY_RULE_SETUP -#line 203 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 203 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return APPENDING; } YY_BREAK case 13: YY_RULE_SETUP -#line 204 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 204 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return DLLIMPORT; } YY_BREAK case 14: YY_RULE_SETUP -#line 205 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 205 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return DLLEXPORT; } YY_BREAK case 15: YY_RULE_SETUP -#line 206 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return EXTERN_WEAK; } YY_BREAK case 16: YY_RULE_SETUP -#line 207 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 207 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return EXTERNAL; } /* Deprecated, turn into external */ YY_BREAK case 17: YY_RULE_SETUP -#line 208 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 208 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return EXTERNAL; } YY_BREAK case 18: YY_RULE_SETUP -#line 209 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 209 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return IMPLEMENTATION; } YY_BREAK case 19: YY_RULE_SETUP -#line 210 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 210 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return ZEROINITIALIZER; } YY_BREAK case 20: YY_RULE_SETUP -#line 211 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return DOTDOTDOT; } YY_BREAK case 21: YY_RULE_SETUP -#line 212 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 212 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return UNDEF; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 213 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return NULL_TOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 214 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 214 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return TO; } YY_BREAK case 24: YY_RULE_SETUP -#line 215 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 215 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return EXCEPT; } YY_BREAK case 25: YY_RULE_SETUP -#line 216 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 216 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return NOT; } /* Deprecated, turned into XOR */ YY_BREAK case 26: YY_RULE_SETUP -#line 217 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 217 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return TAIL; } YY_BREAK case 27: YY_RULE_SETUP -#line 218 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 218 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return TARGET; } YY_BREAK case 28: YY_RULE_SETUP -#line 219 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 219 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return TRIPLE; } YY_BREAK case 29: YY_RULE_SETUP -#line 220 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 220 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return DEPLIBS; } YY_BREAK case 30: YY_RULE_SETUP -#line 221 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 221 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return ENDIAN; } YY_BREAK case 31: YY_RULE_SETUP -#line 222 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 222 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return POINTERSIZE; } YY_BREAK case 32: YY_RULE_SETUP -#line 223 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 223 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return DATALAYOUT; } YY_BREAK case 33: YY_RULE_SETUP -#line 224 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 224 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return LITTLE; } YY_BREAK case 34: YY_RULE_SETUP -#line 225 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 225 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return BIG; } YY_BREAK case 35: YY_RULE_SETUP -#line 226 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 226 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return VOLATILE; } YY_BREAK case 36: YY_RULE_SETUP -#line 227 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 227 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return ALIGN; } YY_BREAK case 37: YY_RULE_SETUP -#line 228 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 228 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return SECTION; } YY_BREAK case 38: YY_RULE_SETUP -#line 229 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 229 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return MODULE; } YY_BREAK case 39: YY_RULE_SETUP -#line 230 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 230 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return ASM_TOK; } YY_BREAK case 40: YY_RULE_SETUP -#line 231 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 231 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return SIDEEFFECT; } YY_BREAK case 41: YY_RULE_SETUP -#line 233 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 233 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return CC_TOK; } YY_BREAK case 42: YY_RULE_SETUP -#line 234 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 234 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return CCC_TOK; } YY_BREAK case 43: YY_RULE_SETUP -#line 235 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 235 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return CSRETCC_TOK; } YY_BREAK case 44: YY_RULE_SETUP -#line 236 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 236 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return FASTCC_TOK; } YY_BREAK case 45: YY_RULE_SETUP -#line 237 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 237 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return COLDCC_TOK; } YY_BREAK case 46: YY_RULE_SETUP -#line 238 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 238 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return X86_STDCALLCC_TOK; } YY_BREAK case 47: YY_RULE_SETUP -#line 239 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 239 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return X86_FASTCALLCC_TOK; } YY_BREAK case 48: YY_RULE_SETUP -#line 241 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 241 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(SBYTE, Type::Int8Ty, Signed); } YY_BREAK case 49: YY_RULE_SETUP -#line 242 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 242 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(UBYTE, Type::Int8Ty, Unsigned); } YY_BREAK case 50: YY_RULE_SETUP -#line 243 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 243 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(SHORT, Type::Int16Ty, Signed); } YY_BREAK case 51: YY_RULE_SETUP -#line 244 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 244 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(USHORT, Type::Int16Ty, Unsigned); } YY_BREAK case 52: YY_RULE_SETUP -#line 245 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 245 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(INT, Type::Int32Ty, Signed); } YY_BREAK case 53: YY_RULE_SETUP -#line 246 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 246 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(UINT, Type::Int32Ty, Unsigned); } YY_BREAK case 54: YY_RULE_SETUP -#line 247 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 247 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(LONG, Type::Int64Ty, Signed); } YY_BREAK case 55: YY_RULE_SETUP -#line 248 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 248 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(ULONG, Type::Int64Ty, Unsigned); } YY_BREAK case 56: YY_RULE_SETUP -#line 249 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 249 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(VOID, Type::VoidTy, Signless ); } YY_BREAK case 57: YY_RULE_SETUP -#line 250 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 250 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(BOOL, Type::Int1Ty, Unsigned ); } YY_BREAK case 58: YY_RULE_SETUP -#line 251 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 251 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(FLOAT, Type::FloatTy, Signless ); } YY_BREAK case 59: YY_RULE_SETUP -#line 252 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 252 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(DOUBLE, Type::DoubleTy,Signless); } YY_BREAK case 60: YY_RULE_SETUP -#line 253 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 253 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TY(LABEL, Type::LabelTy, Signless ); } YY_BREAK case 61: YY_RULE_SETUP -#line 254 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 254 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return TYPE; } YY_BREAK case 62: YY_RULE_SETUP -#line 255 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 255 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return OPAQUE; } YY_BREAK case 63: YY_RULE_SETUP -#line 257 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 257 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, AddOp, ADD); } YY_BREAK case 64: YY_RULE_SETUP -#line 258 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, SubOp, SUB); } YY_BREAK case 65: YY_RULE_SETUP -#line 259 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 259 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, MulOp, MUL); } YY_BREAK case 66: YY_RULE_SETUP -#line 260 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 260 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, DivOp, DIV); } YY_BREAK case 67: YY_RULE_SETUP -#line 261 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 261 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, UDivOp, UDIV); } YY_BREAK case 68: YY_RULE_SETUP -#line 262 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 262 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, SDivOp, SDIV); } YY_BREAK case 69: YY_RULE_SETUP -#line 263 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 263 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, FDivOp, FDIV); } YY_BREAK case 70: YY_RULE_SETUP -#line 264 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 264 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, RemOp, REM); } YY_BREAK case 71: YY_RULE_SETUP -#line 265 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 265 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, URemOp, UREM); } YY_BREAK case 72: YY_RULE_SETUP -#line 266 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 266 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, SRemOp, SREM); } YY_BREAK case 73: YY_RULE_SETUP -#line 267 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 267 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, FRemOp, FREM); } YY_BREAK case 74: YY_RULE_SETUP -#line 268 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 268 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, AndOp, AND); } YY_BREAK case 75: YY_RULE_SETUP -#line 269 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 269 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, OrOp , OR ); } YY_BREAK case 76: YY_RULE_SETUP -#line 270 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 270 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, XorOp, XOR); } YY_BREAK case 77: YY_RULE_SETUP -#line 271 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 271 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, SetNE, SETNE); } YY_BREAK case 78: YY_RULE_SETUP -#line 272 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 272 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, SetEQ, SETEQ); } YY_BREAK case 79: YY_RULE_SETUP -#line 273 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 273 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, SetLT, SETLT); } YY_BREAK case 80: YY_RULE_SETUP -#line 274 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 274 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, SetGT, SETGT); } YY_BREAK case 81: YY_RULE_SETUP -#line 275 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, SetLE, SETLE); } YY_BREAK case 82: YY_RULE_SETUP -#line 276 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 276 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, SetGE, SETGE); } YY_BREAK case 83: YY_RULE_SETUP -#line 277 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 277 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, ShlOp, SHL); } YY_BREAK case 84: YY_RULE_SETUP -#line 278 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 278 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, ShrOp, SHR); } YY_BREAK case 85: YY_RULE_SETUP -#line 279 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 279 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, LShrOp, LSHR); } YY_BREAK case 86: YY_RULE_SETUP -#line 280 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 280 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(BinaryOpVal, AShrOp, ASHR); } YY_BREAK case 87: YY_RULE_SETUP -#line 282 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 282 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(OtherOpVal, ICmpOp, ICMP); } YY_BREAK case 88: YY_RULE_SETUP -#line 283 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 283 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(OtherOpVal, FCmpOp, FCMP); } YY_BREAK case 89: YY_RULE_SETUP -#line 285 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 285 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return EQ; } YY_BREAK case 90: YY_RULE_SETUP -#line 286 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 286 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return NE; } YY_BREAK case 91: YY_RULE_SETUP -#line 287 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 287 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return SLT; } YY_BREAK case 92: YY_RULE_SETUP -#line 288 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 288 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return SGT; } YY_BREAK case 93: YY_RULE_SETUP -#line 289 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 289 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return SLE; } YY_BREAK case 94: YY_RULE_SETUP -#line 290 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 290 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return SGE; } YY_BREAK case 95: YY_RULE_SETUP -#line 291 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 291 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return ULT; } YY_BREAK case 96: YY_RULE_SETUP -#line 292 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 292 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return UGT; } YY_BREAK case 97: YY_RULE_SETUP -#line 293 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 293 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return ULE; } YY_BREAK case 98: YY_RULE_SETUP -#line 294 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 294 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return UGE; } YY_BREAK case 99: YY_RULE_SETUP -#line 295 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 295 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return OEQ; } YY_BREAK case 100: YY_RULE_SETUP -#line 296 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 296 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return ONE; } YY_BREAK case 101: YY_RULE_SETUP -#line 297 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 297 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return OLT; } YY_BREAK case 102: YY_RULE_SETUP -#line 298 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 298 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return OGT; } YY_BREAK case 103: YY_RULE_SETUP -#line 299 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 299 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return OLE; } YY_BREAK case 104: YY_RULE_SETUP -#line 300 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 300 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return OGE; } YY_BREAK case 105: YY_RULE_SETUP -#line 301 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 301 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return ORD; } YY_BREAK case 106: YY_RULE_SETUP -#line 302 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 302 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return UNO; } YY_BREAK case 107: YY_RULE_SETUP -#line 303 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 303 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return UEQ; } YY_BREAK case 108: YY_RULE_SETUP -#line 304 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 304 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return UNE; } YY_BREAK case 109: YY_RULE_SETUP -#line 306 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 306 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(OtherOpVal, PHIOp, PHI_TOK); } YY_BREAK case 110: YY_RULE_SETUP -#line 307 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 307 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(OtherOpVal, CallOp, CALL); } YY_BREAK case 111: YY_RULE_SETUP -#line 308 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 308 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, CastOp, CAST); } YY_BREAK case 112: YY_RULE_SETUP -#line 309 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 309 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, TruncOp, TRUNC); } YY_BREAK case 113: YY_RULE_SETUP -#line 310 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 310 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, ZExtOp , ZEXT); } YY_BREAK case 114: YY_RULE_SETUP -#line 311 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 311 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, SExtOp, SEXT); } YY_BREAK case 115: YY_RULE_SETUP -#line 312 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 312 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, FPTruncOp, FPTRUNC); } YY_BREAK case 116: YY_RULE_SETUP -#line 313 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 313 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, FPExtOp, FPEXT); } YY_BREAK case 117: YY_RULE_SETUP -#line 314 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 314 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, FPToUIOp, FPTOUI); } YY_BREAK case 118: YY_RULE_SETUP -#line 315 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 315 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, FPToSIOp, FPTOSI); } YY_BREAK case 119: YY_RULE_SETUP -#line 316 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 316 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, UIToFPOp, UITOFP); } YY_BREAK case 120: YY_RULE_SETUP -#line 317 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 317 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, SIToFPOp, SITOFP); } YY_BREAK case 121: YY_RULE_SETUP -#line 318 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 318 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, PtrToIntOp, PTRTOINT); } YY_BREAK case 122: YY_RULE_SETUP -#line 319 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 319 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, IntToPtrOp, INTTOPTR); } YY_BREAK case 123: YY_RULE_SETUP -#line 320 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 320 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(CastOpVal, BitCastOp, BITCAST); } YY_BREAK case 124: YY_RULE_SETUP -#line 321 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 321 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(OtherOpVal, SelectOp, SELECT); } YY_BREAK case 125: YY_RULE_SETUP -#line 322 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 322 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return VANEXT_old; } YY_BREAK case 126: YY_RULE_SETUP -#line 323 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 323 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return VAARG_old; } YY_BREAK case 127: YY_RULE_SETUP -#line 324 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 324 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(OtherOpVal, VAArg , VAARG); } YY_BREAK case 128: YY_RULE_SETUP -#line 325 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 325 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(TermOpVal, RetOp, RET); } YY_BREAK case 129: YY_RULE_SETUP -#line 326 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 326 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(TermOpVal, BrOp, BR); } YY_BREAK case 130: YY_RULE_SETUP -#line 327 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 327 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(TermOpVal, SwitchOp, SWITCH); } YY_BREAK case 131: YY_RULE_SETUP -#line 328 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 328 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(TermOpVal, InvokeOp, INVOKE); } YY_BREAK case 132: YY_RULE_SETUP -#line 329 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 329 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return UNWIND; } YY_BREAK case 133: YY_RULE_SETUP -#line 330 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 330 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(TermOpVal, UnreachableOp, UNREACHABLE); } YY_BREAK case 134: YY_RULE_SETUP -#line 332 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 332 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(MemOpVal, MallocOp, MALLOC); } YY_BREAK case 135: YY_RULE_SETUP -#line 333 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 333 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(MemOpVal, AllocaOp, ALLOCA); } YY_BREAK case 136: YY_RULE_SETUP -#line 334 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 334 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(MemOpVal, FreeOp, FREE); } YY_BREAK case 137: YY_RULE_SETUP -#line 335 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 335 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(MemOpVal, LoadOp, LOAD); } YY_BREAK case 138: YY_RULE_SETUP -#line 336 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 336 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(MemOpVal, StoreOp, STORE); } YY_BREAK case 139: YY_RULE_SETUP -#line 337 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 337 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(MemOpVal, GetElementPtrOp, GETELEMENTPTR); } YY_BREAK case 140: YY_RULE_SETUP -#line 339 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 339 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(OtherOpVal, ExtractElementOp, EXTRACTELEMENT); } YY_BREAK case 141: YY_RULE_SETUP -#line 340 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 340 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(OtherOpVal, InsertElementOp, INSERTELEMENT); } YY_BREAK case 142: YY_RULE_SETUP -#line 341 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 341 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { RET_TOK(OtherOpVal, ShuffleVectorOp, SHUFFLEVECTOR); } YY_BREAK case 143: YY_RULE_SETUP -#line 344 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 344 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { UnEscapeLexed(yytext+1); Upgradelval.StrVal = strdup(yytext+1); // Skip % @@ -2042,7 +2042,7 @@ YY_RULE_SETUP YY_BREAK case 144: YY_RULE_SETUP -#line 349 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 349 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { yytext[strlen(yytext)-1] = 0; // nuke colon UnEscapeLexed(yytext); @@ -2052,7 +2052,7 @@ YY_RULE_SETUP YY_BREAK case 145: YY_RULE_SETUP -#line 355 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 355 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { yytext[strlen(yytext)-2] = 0; // nuke colon, end quote UnEscapeLexed(yytext+1); @@ -2062,7 +2062,7 @@ YY_RULE_SETUP YY_BREAK case 146: YY_RULE_SETUP -#line 362 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 362 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { // Note that we cannot unescape a string constant here! The // string constant might contain a \00 which would not be // understood by the string stuff. It is valid to make a @@ -2075,12 +2075,12 @@ YY_RULE_SETUP YY_BREAK case 147: YY_RULE_SETUP -#line 373 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 373 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { Upgradelval.UInt64Val = atoull(yytext); return EUINT64VAL; } YY_BREAK case 148: YY_RULE_SETUP -#line 374 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 374 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { uint64_t Val = atoull(yytext+1); // +1: we have bigger negative range @@ -2092,7 +2092,7 @@ YY_RULE_SETUP YY_BREAK case 149: YY_RULE_SETUP -#line 382 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 382 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { Upgradelval.UInt64Val = HexIntToVal(yytext+3); return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; @@ -2100,7 +2100,7 @@ YY_RULE_SETUP YY_BREAK case 150: YY_RULE_SETUP -#line 387 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 387 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { uint64_t Val = atoull(yytext+1); if ((unsigned)Val != Val) @@ -2111,7 +2111,7 @@ YY_RULE_SETUP YY_BREAK case 151: YY_RULE_SETUP -#line 394 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 394 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { uint64_t Val = atoull(yytext+2); // +1: we have bigger negative range @@ -2123,16 +2123,16 @@ YY_RULE_SETUP YY_BREAK case 152: YY_RULE_SETUP -#line 403 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 403 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { Upgradelval.FPVal = atof(yytext); return FPVAL; } YY_BREAK case 153: YY_RULE_SETUP -#line 404 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 404 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { Upgradelval.FPVal = HexToFP(yytext); return FPVAL; } YY_BREAK case YY_STATE_EOF(INITIAL): -#line 406 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 406 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { /* Make sure to free the internal buffers for flex when we are * done reading our input! @@ -2143,17 +2143,17 @@ case YY_STATE_EOF(INITIAL): YY_BREAK case 154: YY_RULE_SETUP -#line 414 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 414 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { /* Ignore whitespace */ } YY_BREAK case 155: YY_RULE_SETUP -#line 415 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 415 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" { return yytext[0]; } YY_BREAK case 156: YY_RULE_SETUP -#line 417 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 417 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 2160 "UpgradeLexer.cpp" @@ -3034,5 +3034,5 @@ int main() return 0; } #endif -#line 417 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeLexer.l" +#line 417 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeLexer.l" diff --git a/llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs b/llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs index 04649f3ce8a59a7a2f18f16f78a0410782629eb3..70ff399bbeb25fd681b8aa29dc393c3c26785adf 100644 --- a/llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs +++ b/llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs @@ -370,14 +370,14 @@ /* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 14 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" #include "UpgradeInternals.h" #include "llvm/CallingConv.h" #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/MathExtras.h" @@ -672,8 +672,10 @@ static Value *getExistingValue(const Type *Ty, const ValID &D) { LookupName = I->second; else LookupName = Name; - SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); - V = SymTab.lookup(Ty, LookupName); + ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); + V = SymTab.lookup(LookupName); + if (V && V->getType() != Ty) + V = 0; } if (!V) { RenameMapType::const_iterator I = CurModule.RenameMap.find(Key); @@ -682,9 +684,11 @@ static Value *getExistingValue(const Type *Ty, const ValID &D) { LookupName = I->second; else LookupName = Name; - V = CurModule.CurrentModule->getValueSymbolTable().lookup(Ty, LookupName); + V = CurModule.CurrentModule->getValueSymbolTable().lookup(LookupName); + if (V && V->getType() != Ty) + V = 0; } - if (V == 0) + if (!V) return 0; D.destroy(); // Free old strdup'd memory... @@ -776,7 +780,7 @@ static Value *getVal(const Type *Ty, const ValID &ID) { // Remember where this forward reference came from. FIXME, shouldn't we try // to recycle these things?? CurModule.PlaceHolderInfo.insert( - std::make_pair(V, std::make_pair(ID, Upgradelineno-1))); + std::make_pair(V, std::make_pair(ID, Upgradelineno))); if (inFunctionScope()) InsertValue(V, CurFun.LateResolveValues); @@ -808,7 +812,7 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { case ValID::NameVal: // Is it a named definition? Name = ID.Name; if (Value *N = CurFun.CurrentFunction-> - getValueSymbolTable().lookup(Type::LabelTy, Name)) { + getValueSymbolTable().lookup(Name)) { if (N->getType() != Type::LabelTy) error("Name '" + Name + "' does not refer to a BasicBlock"); BB = cast(N); @@ -1042,16 +1046,8 @@ static void setValueName(Value *V, char *NameStr) { assert(inFunctionScope() && "Must be in function scope"); // Search the function's symbol table for an existing value of this name - Value* Existing = 0; - SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); - SymbolTable::plane_const_iterator PI = ST.plane_begin(), PE =ST.plane_end(); - for ( ; PI != PE; ++PI) { - SymbolTable::value_const_iterator VI = PI->second.find(Name); - if (VI != PI->second.end()) { - Existing = VI->second; - break; - } - } + ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); + Value* Existing = ST.lookup(Name); if (Existing) { // An existing value of the same name was found. This might have happened // because of the integer type planes collapsing in LLVM 2.0. @@ -1811,7 +1807,7 @@ using namespace llvm; #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 1435 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1431 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1854,7 +1850,7 @@ typedef union YYSTYPE { llvm::Module::Endianness Endianness; } YYSTYPE; /* Line 196 of yacc.c. */ -#line 1858 "UpgradeParser.tab.c" +#line 1854 "UpgradeParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1866,7 +1862,7 @@ typedef union YYSTYPE { /* Line 219 of yacc.c. */ -#line 1870 "UpgradeParser.tab.c" +#line 1866 "UpgradeParser.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -2224,37 +2220,37 @@ static const short int yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 1575, 1575, 1576, 1584, 1585, 1595, 1595, 1595, 1595, - 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1599, 1599, 1599, - 1603, 1603, 1603, 1603, 1603, 1603, 1607, 1607, 1608, 1608, - 1609, 1609, 1610, 1610, 1611, 1611, 1615, 1615, 1616, 1616, - 1617, 1617, 1618, 1618, 1619, 1619, 1620, 1620, 1621, 1621, - 1622, 1623, 1626, 1626, 1626, 1626, 1630, 1630, 1630, 1630, - 1630, 1630, 1630, 1631, 1631, 1631, 1631, 1631, 1631, 1637, - 1637, 1637, 1637, 1641, 1641, 1641, 1641, 1645, 1645, 1649, - 1649, 1654, 1657, 1662, 1663, 1664, 1665, 1666, 1667, 1668, - 1669, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1690, - 1691, 1699, 1700, 1708, 1717, 1718, 1725, 1726, 1730, 1734, - 1750, 1751, 1758, 1759, 1766, 1774, 1774, 1774, 1774, 1774, - 1774, 1774, 1775, 1775, 1775, 1775, 1775, 1780, 1784, 1788, - 1793, 1802, 1822, 1828, 1841, 1850, 1854, 1865, 1869, 1882, - 1886, 1893, 1894, 1900, 1907, 1919, 1949, 1962, 1985, 2013, - 2035, 2046, 2068, 2079, 2088, 2093, 2151, 2158, 2166, 2173, - 2180, 2184, 2188, 2197, 2212, 2225, 2234, 2262, 2275, 2284, - 2290, 2296, 2307, 2313, 2319, 2330, 2331, 2340, 2341, 2353, - 2362, 2363, 2364, 2365, 2366, 2382, 2402, 2404, 2406, 2406, - 2413, 2413, 2420, 2420, 2427, 2427, 2435, 2437, 2439, 2444, - 2458, 2459, 2463, 2466, 2474, 2478, 2485, 2489, 2493, 2497, - 2505, 2505, 2509, 2510, 2514, 2522, 2527, 2535, 2536, 2543, - 2550, 2554, 2669, 2669, 2673, 2683, 2683, 2687, 2691, 2693, - 2694, 2698, 2698, 2710, 2711, 2716, 2717, 2718, 2719, 2720, - 2721, 2722, 2723, 2724, 2745, 2748, 2763, 2764, 2769, 2769, - 2777, 2786, 2789, 2798, 2808, 2813, 2822, 2833, 2833, 2836, - 2839, 2842, 2846, 2852, 2867, 2873, 2929, 2932, 2938, 2948, - 2961, 2990, 2998, 3006, 3010, 3017, 3018, 3022, 3025, 3031, - 3048, 3064, 3078, 3090, 3102, 3113, 3131, 3140, 3149, 3156, - 3177, 3201, 3207, 3213, 3219, 3235, 3313, 3321, 3322, 3326, - 3327, 3331, 3337, 3343, 3349, 3355, 3362, 3374, 3388 + 0, 1571, 1571, 1572, 1580, 1581, 1591, 1591, 1591, 1591, + 1591, 1591, 1591, 1591, 1591, 1591, 1591, 1595, 1595, 1595, + 1599, 1599, 1599, 1599, 1599, 1599, 1603, 1603, 1604, 1604, + 1605, 1605, 1606, 1606, 1607, 1607, 1611, 1611, 1612, 1612, + 1613, 1613, 1614, 1614, 1615, 1615, 1616, 1616, 1617, 1617, + 1618, 1619, 1622, 1622, 1622, 1622, 1626, 1626, 1626, 1626, + 1626, 1626, 1626, 1627, 1627, 1627, 1627, 1627, 1627, 1633, + 1633, 1633, 1633, 1637, 1637, 1637, 1637, 1641, 1641, 1645, + 1645, 1650, 1653, 1658, 1659, 1660, 1661, 1662, 1663, 1664, + 1665, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1686, + 1687, 1695, 1696, 1704, 1713, 1714, 1721, 1722, 1726, 1730, + 1746, 1747, 1754, 1755, 1762, 1770, 1770, 1770, 1770, 1770, + 1770, 1770, 1771, 1771, 1771, 1771, 1771, 1776, 1780, 1784, + 1789, 1798, 1818, 1824, 1837, 1846, 1850, 1861, 1865, 1878, + 1882, 1889, 1890, 1896, 1903, 1915, 1945, 1958, 1981, 2009, + 2031, 2042, 2064, 2075, 2084, 2089, 2147, 2154, 2162, 2169, + 2176, 2180, 2184, 2193, 2208, 2221, 2230, 2258, 2271, 2280, + 2286, 2292, 2303, 2309, 2315, 2326, 2327, 2336, 2337, 2349, + 2358, 2359, 2360, 2361, 2362, 2378, 2398, 2400, 2402, 2402, + 2409, 2409, 2416, 2416, 2423, 2423, 2431, 2433, 2435, 2440, + 2454, 2455, 2459, 2462, 2470, 2474, 2481, 2485, 2489, 2493, + 2501, 2501, 2505, 2506, 2510, 2518, 2523, 2531, 2532, 2539, + 2546, 2550, 2686, 2686, 2690, 2700, 2700, 2704, 2708, 2710, + 2711, 2715, 2715, 2727, 2728, 2733, 2734, 2735, 2736, 2737, + 2738, 2739, 2740, 2741, 2762, 2765, 2780, 2781, 2786, 2786, + 2794, 2803, 2806, 2815, 2825, 2830, 2839, 2850, 2850, 2853, + 2856, 2859, 2863, 2869, 2884, 2890, 2946, 2949, 2955, 2965, + 2978, 3007, 3015, 3023, 3027, 3034, 3035, 3039, 3042, 3048, + 3065, 3081, 3095, 3107, 3119, 3130, 3148, 3157, 3166, 3173, + 3194, 3218, 3224, 3230, 3236, 3252, 3330, 3338, 3339, 3343, + 3344, 3348, 3354, 3360, 3366, 3372, 3379, 3391, 3405 }; #endif @@ -3660,7 +3656,7 @@ yyreduce: switch (yyn) { case 3: -#line 1576 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1572 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! error("Value too large for type"); @@ -3669,7 +3665,7 @@ yyreduce: break; case 5: -#line 1585 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1581 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! error("Value too large for type"); @@ -3678,226 +3674,226 @@ yyreduce: break; case 26: -#line 1607 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1603 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.IPred) = ICmpInst::ICMP_EQ; ;} break; case 27: -#line 1607 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1603 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.IPred) = ICmpInst::ICMP_NE; ;} break; case 28: -#line 1608 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1604 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.IPred) = ICmpInst::ICMP_SLT; ;} break; case 29: -#line 1608 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1604 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.IPred) = ICmpInst::ICMP_SGT; ;} break; case 30: -#line 1609 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1605 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.IPred) = ICmpInst::ICMP_SLE; ;} break; case 31: -#line 1609 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1605 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.IPred) = ICmpInst::ICMP_SGE; ;} break; case 32: -#line 1610 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1606 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.IPred) = ICmpInst::ICMP_ULT; ;} break; case 33: -#line 1610 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1606 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.IPred) = ICmpInst::ICMP_UGT; ;} break; case 34: -#line 1611 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1607 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.IPred) = ICmpInst::ICMP_ULE; ;} break; case 35: -#line 1611 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1607 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.IPred) = ICmpInst::ICMP_UGE; ;} break; case 36: -#line 1615 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1611 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_OEQ; ;} break; case 37: -#line 1615 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1611 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_ONE; ;} break; case 38: -#line 1616 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1612 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_OLT; ;} break; case 39: -#line 1616 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1612 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_OGT; ;} break; case 40: -#line 1617 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1613 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_OLE; ;} break; case 41: -#line 1617 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1613 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_OGE; ;} break; case 42: -#line 1618 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1614 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_ORD; ;} break; case 43: -#line 1618 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1614 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_UNO; ;} break; case 44: -#line 1619 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1615 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_UEQ; ;} break; case 45: -#line 1619 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1615 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_UNE; ;} break; case 46: -#line 1620 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1616 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_ULT; ;} break; case 47: -#line 1620 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1616 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_UGT; ;} break; case 48: -#line 1621 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1617 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_ULE; ;} break; case 49: -#line 1621 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1617 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_UGE; ;} break; case 50: -#line 1622 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1618 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_TRUE; ;} break; case 51: -#line 1623 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1619 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FPred) = FCmpInst::FCMP_FALSE; ;} break; case 81: -#line 1654 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1650 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.StrVal) = (yyvsp[-1].StrVal); ;} break; case 82: -#line 1657 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1653 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.StrVal) = 0; ;} break; case 83: -#line 1662 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1658 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 84: -#line 1663 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1659 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 85: -#line 1664 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1660 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 86: -#line 1665 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1661 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 87: -#line 1666 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1662 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 88: -#line 1667 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1663 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 89: -#line 1668 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1664 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 90: -#line 1669 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1665 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 91: -#line 1673 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1669 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurFun.LastCC = (yyval.UIntVal) = OldCallingConv::C; ;} break; case 92: -#line 1674 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1670 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurFun.LastCC = (yyval.UIntVal) = OldCallingConv::C; ;} break; case 93: -#line 1675 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1671 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurFun.LastCC = (yyval.UIntVal) = OldCallingConv::CSRet; ;} break; case 94: -#line 1676 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1672 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurFun.LastCC = (yyval.UIntVal) = OldCallingConv::Fast; ;} break; case 95: -#line 1677 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1673 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurFun.LastCC = (yyval.UIntVal) = OldCallingConv::Cold; ;} break; case 96: -#line 1678 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1674 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurFun.LastCC = (yyval.UIntVal) = OldCallingConv::X86_StdCall; ;} break; case 97: -#line 1679 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1675 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurFun.LastCC = (yyval.UIntVal) = OldCallingConv::X86_FastCall; ;} break; case 98: -#line 1680 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1676 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) error("Calling conv too large"); @@ -3906,12 +3902,12 @@ yyreduce: break; case 99: -#line 1690 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1686 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.UIntVal) = 0; ;} break; case 100: -#line 1691 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1687 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3920,12 +3916,12 @@ yyreduce: break; case 101: -#line 1699 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1695 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.UIntVal) = 0; ;} break; case 102: -#line 1700 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1696 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3934,7 +3930,7 @@ yyreduce: break; case 103: -#line 1708 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1704 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') @@ -3944,27 +3940,27 @@ yyreduce: break; case 104: -#line 1717 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1713 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.StrVal) = 0; ;} break; case 105: -#line 1718 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1714 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.StrVal) = (yyvsp[0].StrVal); ;} break; case 106: -#line 1725 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1721 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" {;} break; case 107: -#line 1726 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1722 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" {;} break; case 108: -#line 1730 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1726 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurGV->setSection((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -3972,7 +3968,7 @@ yyreduce: break; case 109: -#line 1734 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1730 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) error("Alignment must be a power of two"); @@ -3982,7 +3978,7 @@ yyreduce: break; case 111: -#line 1751 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1747 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeVal).T = new PATypeHolder((yyvsp[0].PrimType).T); (yyval.TypeVal).S = Signless; @@ -3990,7 +3986,7 @@ yyreduce: break; case 113: -#line 1759 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1755 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeVal).T = new PATypeHolder((yyvsp[0].PrimType).T); (yyval.TypeVal).S = Signless; @@ -3998,7 +3994,7 @@ yyreduce: break; case 114: -#line 1766 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1762 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!UpRefs.empty()) error("Invalid upreference in type: " + (*(yyvsp[0].TypeVal).T)->getDescription()); @@ -4007,7 +4003,7 @@ yyreduce: break; case 127: -#line 1780 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1776 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeVal).T = new PATypeHolder((yyvsp[0].PrimType).T); (yyval.TypeVal).S = (yyvsp[0].PrimType).S; @@ -4015,7 +4011,7 @@ yyreduce: break; case 128: -#line 1784 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1780 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeVal).T = new PATypeHolder(OpaqueType::get()); (yyval.TypeVal).S = Signless; @@ -4023,7 +4019,7 @@ yyreduce: break; case 129: -#line 1788 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1784 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Named types are also simple types... const Type* tmp = getType((yyvsp[0].ValIDVal)); (yyval.TypeVal).T = new PATypeHolder(tmp); @@ -4032,7 +4028,7 @@ yyreduce: break; case 130: -#line 1793 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1789 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Type UpReference if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) error("Value out of range"); @@ -4045,7 +4041,7 @@ yyreduce: break; case 131: -#line 1802 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1798 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Function derived type? std::vector Params; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -4069,7 +4065,7 @@ yyreduce: break; case 132: -#line 1822 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1818 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Sized array type? (yyval.TypeVal).T = new PATypeHolder(HandleUpRefs(ArrayType::get((yyvsp[-1].TypeVal).T->get(), (unsigned)(yyvsp[-3].UInt64Val)))); @@ -4079,7 +4075,7 @@ yyreduce: break; case 133: -#line 1828 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1824 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Packed array type? const llvm::Type* ElemTy = (yyvsp[-1].TypeVal).T->get(); if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) @@ -4096,7 +4092,7 @@ yyreduce: break; case 134: -#line 1841 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1837 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -4109,7 +4105,7 @@ yyreduce: break; case 135: -#line 1850 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1846 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Empty structure type? (yyval.TypeVal).T = new PATypeHolder(StructType::get(std::vector())); (yyval.TypeVal).S = Signless; @@ -4117,7 +4113,7 @@ yyreduce: break; case 136: -#line 1854 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1850 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Packed Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[-2].TypeList)->begin(), @@ -4132,7 +4128,7 @@ yyreduce: break; case 137: -#line 1865 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1861 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Empty packed structure type? (yyval.TypeVal).T = new PATypeHolder(StructType::get(std::vector(),true)); (yyval.TypeVal).S = Signless; @@ -4140,7 +4136,7 @@ yyreduce: break; case 138: -#line 1869 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1865 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Pointer type? if ((yyvsp[-1].TypeVal).T->get() == Type::LabelTy) error("Cannot form a pointer to a basic block"); @@ -4151,7 +4147,7 @@ yyreduce: break; case 139: -#line 1882 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1878 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back((yyvsp[0].TypeVal)); @@ -4159,14 +4155,14 @@ yyreduce: break; case 140: -#line 1886 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1882 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back((yyvsp[0].TypeVal)); ;} break; case 142: -#line 1894 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1890 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { PATypeInfo VoidTI; VoidTI.T = new PATypeHolder(Type::VoidTy); @@ -4176,7 +4172,7 @@ yyreduce: break; case 143: -#line 1900 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1896 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeList) = new std::list(); PATypeInfo VoidTI; @@ -4187,14 +4183,14 @@ yyreduce: break; case 144: -#line 1907 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1903 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeList) = new std::list(); ;} break; case 145: -#line 1919 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1915 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Nonempty unsized arr const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal).T->get()); if (ATy == 0) @@ -4228,7 +4224,7 @@ yyreduce: break; case 146: -#line 1949 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1945 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal).T->get()); if (ATy == 0) @@ -4245,7 +4241,7 @@ yyreduce: break; case 147: -#line 1962 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1958 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal).T->get()); if (ATy == 0) @@ -4272,7 +4268,7 @@ yyreduce: break; case 148: -#line 1985 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1981 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Nonempty unsized arr const PackedType *PTy = dyn_cast((yyvsp[-3].TypeVal).T->get()); if (PTy == 0) @@ -4304,7 +4300,7 @@ yyreduce: break; case 149: -#line 2013 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2009 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const StructType *STy = dyn_cast((yyvsp[-3].TypeVal).T->get()); if (STy == 0) @@ -4330,7 +4326,7 @@ yyreduce: break; case 150: -#line 2035 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2031 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const StructType *STy = dyn_cast((yyvsp[-2].TypeVal).T->get()); if (STy == 0) @@ -4345,7 +4341,7 @@ yyreduce: break; case 151: -#line 2046 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2042 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const StructType *STy = dyn_cast((yyvsp[-5].TypeVal).T->get()); if (STy == 0) @@ -4371,7 +4367,7 @@ yyreduce: break; case 152: -#line 2068 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2064 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const StructType *STy = dyn_cast((yyvsp[-4].TypeVal).T->get()); if (STy == 0) @@ -4386,7 +4382,7 @@ yyreduce: break; case 153: -#line 2079 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2075 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal).T->get()); if (PTy == 0) @@ -4399,7 +4395,7 @@ yyreduce: break; case 154: -#line 2088 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2084 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ConstVal).C = UndefValue::get((yyvsp[-1].TypeVal).T->get()); (yyval.ConstVal).S = (yyvsp[-1].TypeVal).S; @@ -4408,7 +4404,7 @@ yyreduce: break; case 155: -#line 2093 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2089 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal).T->get()); if (Ty == 0) @@ -4470,7 +4466,7 @@ yyreduce: break; case 156: -#line 2151 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2147 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[-1].TypeVal).T->get() != (yyvsp[0].ConstVal).C->getType()) error("Mismatched types for constant expression"); @@ -4481,7 +4477,7 @@ yyreduce: break; case 157: -#line 2158 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2154 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-1].TypeVal).T->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) @@ -4493,7 +4489,7 @@ yyreduce: break; case 158: -#line 2166 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2162 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // integral constants const Type *Ty = (yyvsp[-1].PrimType).T; if (!ConstantInt::isValueValidForType(Ty, (yyvsp[0].SInt64Val))) @@ -4504,7 +4500,7 @@ yyreduce: break; case 159: -#line 2173 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2169 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // integral constants const Type *Ty = (yyvsp[-1].PrimType).T; if (!ConstantInt::isValueValidForType(Ty, (yyvsp[0].UInt64Val))) @@ -4515,7 +4511,7 @@ yyreduce: break; case 160: -#line 2180 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Boolean constants (yyval.ConstVal).C = ConstantInt::get(Type::Int1Ty, true); (yyval.ConstVal).S = Unsigned; @@ -4523,7 +4519,7 @@ yyreduce: break; case 161: -#line 2184 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2180 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Boolean constants (yyval.ConstVal).C = ConstantInt::get(Type::Int1Ty, false); (yyval.ConstVal).S = Unsigned; @@ -4531,7 +4527,7 @@ yyreduce: break; case 162: -#line 2188 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2184 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Float & Double constants if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType).T, (yyvsp[0].FPVal))) error("Floating point constant invalid for type"); @@ -4541,7 +4537,7 @@ yyreduce: break; case 163: -#line 2197 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2193 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type* SrcTy = (yyvsp[-3].ConstVal).C->getType(); const Type* DstTy = (yyvsp[-1].TypeVal).T->get(); @@ -4560,7 +4556,7 @@ yyreduce: break; case 164: -#line 2212 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2208 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-2].ConstVal).C->getType(); if (!isa(Ty)) @@ -4577,7 +4573,7 @@ yyreduce: break; case 165: -#line 2225 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2221 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-5].ConstVal).C->getType()->isInteger() || cast((yyvsp[-5].ConstVal).C->getType())->getBitWidth() != 1) @@ -4590,7 +4586,7 @@ yyreduce: break; case 166: -#line 2234 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2230 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-3].ConstVal).C->getType(); if (Ty != (yyvsp[-1].ConstVal).C->getType()) @@ -4622,7 +4618,7 @@ yyreduce: break; case 167: -#line 2262 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type* Ty = (yyvsp[-3].ConstVal).C->getType(); if (Ty != (yyvsp[-1].ConstVal).C->getType()) @@ -4639,7 +4635,7 @@ yyreduce: break; case 168: -#line 2275 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2271 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type* Ty = (yyvsp[-3].ConstVal).C->getType(); if (Ty != (yyvsp[-1].ConstVal).C->getType()) @@ -4652,7 +4648,7 @@ yyreduce: break; case 169: -#line 2284 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2280 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[-3].ConstVal).C->getType() != (yyvsp[-1].ConstVal).C->getType()) error("icmp operand types must match"); @@ -4662,7 +4658,7 @@ yyreduce: break; case 170: -#line 2290 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2286 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[-3].ConstVal).C->getType() != (yyvsp[-1].ConstVal).C->getType()) error("fcmp operand types must match"); @@ -4672,7 +4668,7 @@ yyreduce: break; case 171: -#line 2296 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2292 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-1].ConstVal).C->getType()->isInteger() || cast((yyvsp[-1].ConstVal).C->getType())->getBitWidth() != 8) @@ -4687,7 +4683,7 @@ yyreduce: break; case 172: -#line 2307 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2303 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C)) error("Invalid extractelement operands"); @@ -4697,7 +4693,7 @@ yyreduce: break; case 173: -#line 2313 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2309 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal).C, (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C)) error("Invalid insertelement operands"); @@ -4707,7 +4703,7 @@ yyreduce: break; case 174: -#line 2319 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2315 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal).C, (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C)) error("Invalid shufflevector operands"); @@ -4717,12 +4713,12 @@ yyreduce: break; case 175: -#line 2330 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2326 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); ;} break; case 176: -#line 2331 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2327 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); @@ -4730,17 +4726,17 @@ yyreduce: break; case 177: -#line 2340 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2336 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.BoolVal) = false; ;} break; case 178: -#line 2341 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2337 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.BoolVal) = true; ;} break; case 179: -#line 2353 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2349 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); CurModule.ModuleDone(); @@ -4748,27 +4744,27 @@ yyreduce: break; case 180: -#line 2362 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2358 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CurFun.FunctionDone(); ;} break; case 181: -#line 2363 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2359 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); ;} break; case 182: -#line 2364 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2360 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); ;} break; case 183: -#line 2365 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2361 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); ;} break; case 184: -#line 2366 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2362 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ModuleVal) = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. @@ -4784,7 +4780,7 @@ yyreduce: break; case 185: -#line 2382 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2378 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: @@ -4808,19 +4804,19 @@ yyreduce: break; case 186: -#line 2402 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2398 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Function prototypes can be in const pool ;} break; case 187: -#line 2404 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2400 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Asm blocks can be in the const pool ;} break; case 188: -#line 2406 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2402 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[0].ConstVal).C == 0) error("Global value initializer is not a constant"); @@ -4829,14 +4825,14 @@ yyreduce: break; case 189: -#line 2410 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2406 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurGV = 0; ;} break; case 190: -#line 2413 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2409 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[0].TypeVal).T->get(); CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), Ty, 0); @@ -4845,14 +4841,14 @@ yyreduce: break; case 191: -#line 2417 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2413 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurGV = 0; ;} break; case 192: -#line 2420 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2416 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[0].TypeVal).T->get(); CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), Ty, 0); @@ -4861,14 +4857,14 @@ yyreduce: break; case 193: -#line 2424 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2420 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurGV = 0; ;} break; case 194: -#line 2427 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2423 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[0].TypeVal).T->get(); CurGV = @@ -4878,32 +4874,32 @@ yyreduce: break; case 195: -#line 2432 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2428 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurGV = 0; ;} break; case 196: -#line 2435 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2431 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { ;} break; case 197: -#line 2437 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2433 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { ;} break; case 198: -#line 2439 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2435 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { ;} break; case 199: -#line 2444 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2440 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); @@ -4918,24 +4914,24 @@ yyreduce: break; case 200: -#line 2458 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2454 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Endianness) = Module::BigEndian; ;} break; case 201: -#line 2459 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2455 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Endianness) = Module::LittleEndian; ;} break; case 202: -#line 2463 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2459 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurModule.setEndianness((yyvsp[0].Endianness)); ;} break; case 203: -#line 2466 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2462 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[0].UInt64Val) == 32) CurModule.setPointerSize(Module::Pointer32); @@ -4947,7 +4943,7 @@ yyreduce: break; case 204: -#line 2474 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2470 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4955,7 +4951,7 @@ yyreduce: break; case 205: -#line 2478 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2474 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4963,7 +4959,7 @@ yyreduce: break; case 207: -#line 2489 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2485 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4971,7 +4967,7 @@ yyreduce: break; case 208: -#line 2493 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2489 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4979,17 +4975,17 @@ yyreduce: break; case 209: -#line 2497 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2493 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { ;} break; case 213: -#line 2510 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2506 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.StrVal) = 0; ;} break; case 214: -#line 2514 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2510 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[-1].TypeVal).T->get() == Type::VoidTy) error("void typed arguments are invalid"); @@ -4998,7 +4994,7 @@ yyreduce: break; case 215: -#line 2522 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2518 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); @@ -5007,7 +5003,7 @@ yyreduce: break; case 216: -#line 2527 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2523 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ArgList) = new std::vector >(); (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); @@ -5016,12 +5012,12 @@ yyreduce: break; case 217: -#line 2535 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2531 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ArgList) = (yyvsp[0].ArgList); ;} break; case 218: -#line 2536 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2532 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); PATypeInfo VoidTI; @@ -5032,7 +5028,7 @@ yyreduce: break; case 219: -#line 2543 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2539 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ArgList) = new std::vector >(); PATypeInfo VoidTI; @@ -5043,12 +5039,12 @@ yyreduce: break; case 220: -#line 2550 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2546 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ArgList) = 0; ;} break; case 221: -#line 2554 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2550 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { UnEscapeLexed((yyvsp[-5].StrVal)); std::string FunctionName((yyvsp[-5].StrVal)); @@ -5059,27 +5055,27 @@ yyreduce: if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy) error("LLVM functions cannot return aggregate types"); - std::vector ParamTypeList; + std::vector ParamTyList; // In LLVM 2.0 the signatures of three varargs intrinsics changed to take // i8*. We check here for those names and override the parameter list // types to ensure the prototype is correct. if (FunctionName == "llvm.va_start" || FunctionName == "llvm.va_end") { - ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::get(Type::Int8Ty)); } else if (FunctionName == "llvm.va_copy") { - ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); - ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::get(Type::Int8Ty)); } else if ((yyvsp[-3].ArgList)) { // If there are arguments... for (std::vector >::iterator I = (yyvsp[-3].ArgList)->begin(), E = (yyvsp[-3].ArgList)->end(); I != E; ++I) { const Type *Ty = I->first.T->get(); - ParamTypeList.push_back(Ty); + ParamTyList.push_back(Ty); } } - bool isVarArg = - ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; - if (isVarArg) ParamTypeList.pop_back(); + bool isVarArg = ParamTyList.size() && ParamTyList.back() == Type::VoidTy; + if (isVarArg) + ParamTyList.pop_back(); // Convert the CSRet calling convention into the corresponding parameter // attribute. @@ -5089,7 +5085,7 @@ yyreduce: ParamAttrs.push_back(FunctionType::StructRetAttribute); // first arg } - const FunctionType *FT = FunctionType::get(RetTy, ParamTypeList, isVarArg, + const FunctionType *FT = FunctionType::get(RetTy, ParamTyList, isVarArg, ParamAttrs); const PointerType *PFT = PointerType::get(FT); delete (yyvsp[-6].TypeVal).T; @@ -5110,18 +5106,37 @@ yyreduce: CurModule.CurrentModule->getFunctionList().remove(Fn); CurModule.CurrentModule->getFunctionList().push_back(Fn); } else if (!FunctionName.empty() && // Merge with an earlier prototype? - (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { - // If this is the case, either we need to be a forward decl, or it needs - // to be. - if (!CurFun.isDeclare && !Fn->isDeclaration()) - error("Redefinition of function '" + FunctionName + "'"); + (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { + if (Fn->getFunctionType() != FT ) { + // The existing function doesn't have the same type. Previously this was + // permitted because the symbol tables had "type planes" and names were + // distinct within a type plane. After PR411 was fixed, this is no + // longer the case. To resolve this we must rename this function. + // However, renaming it can cause problems if its linkage is external + // because it could cause a link failure. We warn about this. + std::string NewName = makeNameUnique(FunctionName); + warning("Renaming function '" + FunctionName + "' as '" + NewName + + "' may cause linkage errors"); + + Fn = new Function(FT, GlobalValue::ExternalLinkage, NewName, + CurModule.CurrentModule); + InsertValue(Fn, CurModule.Values); + RenameMapKey Key = std::make_pair(FunctionName,PFT); + CurModule.RenameMap[Key] = NewName; + } else { + // The types are the same. Either the existing or the current function + // needs to be a forward declaration. If not, they're attempting to + // redefine a function. + if (!CurFun.isDeclare && !Fn->isDeclaration()) + error("Redefinition of function '" + FunctionName + "'"); - // Make sure to strip off any argument names so we can't get conflicts. - if (Fn->isDeclaration()) - for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); - AI != AE; ++AI) - AI->setName(""); - } else { // Not already defined? + // Make sure to strip off any argument names so we can't get conflicts. + if (Fn->isDeclaration()) + for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); + AI != AE; ++AI) + AI->setName(""); + } + } else { // Not already defined? Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, CurModule.CurrentModule); @@ -5152,8 +5167,10 @@ yyreduce: (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); - for (std::vector >::iterator - I = (yyvsp[-3].ArgList)->begin(), E = (yyvsp[-3].ArgList)->end(); I != E; ++I, ++ArgIt) { + Function::arg_iterator ArgEnd = Fn->arg_end(); + std::vector >::iterator I = (yyvsp[-3].ArgList)->begin(); + std::vector >::iterator E = (yyvsp[-3].ArgList)->end(); + for ( ; I != E && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->first.T; // Delete the typeholder... setValueName(ArgIt, I->second); // Insert arg into symtab... InsertValue(ArgIt); @@ -5164,7 +5181,7 @@ yyreduce: break; case 224: -#line 2673 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2690 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -5175,29 +5192,29 @@ yyreduce: break; case 227: -#line 2687 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2704 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); ;} break; case 229: -#line 2693 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2710 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;} break; case 230: -#line 2694 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2711 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;} break; case 231: -#line 2698 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2715 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { CurFun.isDeclare = true; ;} break; case 232: -#line 2698 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2715 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); @@ -5206,57 +5223,57 @@ yyreduce: break; case 233: -#line 2710 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2727 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.BoolVal) = false; ;} break; case 234: -#line 2711 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2728 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.BoolVal) = true; ;} break; case 235: -#line 2716 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2733 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); ;} break; case 236: -#line 2717 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2734 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); ;} break; case 237: -#line 2718 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2735 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); ;} break; case 238: -#line 2719 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2736 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::get(Type::Int1Ty, true)); ;} break; case 239: -#line 2720 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2737 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::get(Type::Int1Ty, false)); ;} break; case 240: -#line 2721 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2738 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::createNull(); ;} break; case 241: -#line 2722 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2739 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::createUndef(); ;} break; case 242: -#line 2723 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2740 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::createZeroInit(); ;} break; case 243: -#line 2724 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2741 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[-1].ConstVector))[0].C->getType(); int NumElements = (yyvsp[-1].ConstVector)->size(); @@ -5281,14 +5298,14 @@ yyreduce: break; case 244: -#line 2745 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2762 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal).C); ;} break; case 245: -#line 2748 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2765 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); std::string AsmStr = std::string((yyvsp[-2].StrVal), End); @@ -5301,17 +5318,17 @@ yyreduce: break; case 246: -#line 2763 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2780 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); ;} break; case 247: -#line 2764 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2781 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); ;} break; case 250: -#line 2777 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2794 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-1].TypeVal).T->get(); (yyval.ValueVal).S = (yyvsp[-1].TypeVal).S; @@ -5321,21 +5338,21 @@ yyreduce: break; case 251: -#line 2786 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2803 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); ;} break; case 252: -#line 2789 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2806 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); ;} break; case 253: -#line 2798 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2815 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); InsertValue((yyvsp[0].TermInstVal)); @@ -5346,7 +5363,7 @@ yyreduce: break; case 254: -#line 2808 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2825 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[0].InstVal).I) (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal).I); @@ -5355,7 +5372,7 @@ yyreduce: break; case 255: -#line 2813 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2830 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); // Make sure to move the basic block to the correct location in the @@ -5368,7 +5385,7 @@ yyreduce: break; case 256: -#line 2822 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2839 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); // Make sure to move the basic block to the correct location in the @@ -5381,21 +5398,21 @@ yyreduce: break; case 259: -#line 2836 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2853 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Return with a result... (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal).V); ;} break; case 260: -#line 2839 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2856 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Return with no result... (yyval.TermInstVal) = new ReturnInst(); ;} break; case 261: -#line 2842 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2859 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); (yyval.TermInstVal) = new BranchInst(tmpBB); @@ -5403,7 +5420,7 @@ yyreduce: break; case 262: -#line 2846 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2863 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); @@ -5413,7 +5430,7 @@ yyreduce: break; case 263: -#line 2852 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2869 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { Value* tmpVal = getVal((yyvsp[-7].PrimType).T, (yyvsp[-6].ValIDVal)); BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); @@ -5432,7 +5449,7 @@ yyreduce: break; case 264: -#line 2867 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2884 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { Value* tmpVal = getVal((yyvsp[-6].PrimType).T, (yyvsp[-5].ValIDVal)); BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); @@ -5442,7 +5459,7 @@ yyreduce: break; case 265: -#line 2874 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2891 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const PointerType *PFTy; const FunctionType *Ty; @@ -5501,21 +5518,21 @@ yyreduce: break; case 266: -#line 2929 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2946 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TermInstVal) = new UnwindInst(); ;} break; case 267: -#line 2932 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2949 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TermInstVal) = new UnreachableInst(); ;} break; case 268: -#line 2938 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2955 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.JumpTable) = (yyvsp[-5].JumpTable); Constant *V = cast(getExistingValue((yyvsp[-4].PrimType).T, (yyvsp[-3].ValIDVal))); @@ -5529,7 +5546,7 @@ yyreduce: break; case 269: -#line 2948 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2965 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getExistingValue((yyvsp[-4].PrimType).T, (yyvsp[-3].ValIDVal))); @@ -5543,7 +5560,7 @@ yyreduce: break; case 270: -#line 2961 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 2978 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { bool omit = false; if ((yyvsp[-1].StrVal)) @@ -5575,7 +5592,7 @@ yyreduce: break; case 271: -#line 2990 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3007 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Used for PHI nodes (yyval.PHIList).P = new std::list >(); (yyval.PHIList).S = (yyvsp[-5].TypeVal).S; @@ -5587,7 +5604,7 @@ yyreduce: break; case 272: -#line 2998 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3015 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.PHIList) = (yyvsp[-6].PHIList); Value* tmpVal = getVal((yyvsp[-6].PHIList).P->front().first->getType(), (yyvsp[-3].ValIDVal)); @@ -5597,7 +5614,7 @@ yyreduce: break; case 273: -#line 3006 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3023 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Used for call statements, and memory insts... (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); @@ -5605,7 +5622,7 @@ yyreduce: break; case 274: -#line 3010 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3027 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValueList) = (yyvsp[-2].ValueList); (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); @@ -5613,26 +5630,26 @@ yyreduce: break; case 276: -#line 3018 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3035 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValueList) = 0; ;} break; case 277: -#line 3022 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3039 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.BoolVal) = true; ;} break; case 278: -#line 3025 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3042 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.BoolVal) = false; ;} break; case 279: -#line 3031 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3048 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type* Ty = (yyvsp[-3].TypeVal).T->get(); if (!Ty->isInteger() && !Ty->isFloatingPoint() && !isa(Ty)) @@ -5653,7 +5670,7 @@ yyreduce: break; case 280: -#line 3048 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3065 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-3].TypeVal).T->get(); if (!Ty->isInteger()) { @@ -5673,7 +5690,7 @@ yyreduce: break; case 281: -#line 3064 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3081 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type* Ty = (yyvsp[-3].TypeVal).T->get(); if(isa(Ty)) @@ -5691,7 +5708,7 @@ yyreduce: break; case 282: -#line 3078 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3095 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-3].TypeVal).T->get(); if (isa(Ty)) @@ -5707,7 +5724,7 @@ yyreduce: break; case 283: -#line 3090 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3107 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-3].TypeVal).T->get(); if (isa(Ty)) @@ -5723,7 +5740,7 @@ yyreduce: break; case 284: -#line 3102 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3119 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { warning("Use of obsolete 'not' instruction: Replacing with 'xor"); const Type *Ty = (yyvsp[0].ValueVal).V->getType(); @@ -5738,7 +5755,7 @@ yyreduce: break; case 285: -#line 3113 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3130 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[0].ValueVal).V->getType()->isInteger() || cast((yyvsp[0].ValueVal).V->getType())->getBitWidth() != 8) @@ -5760,7 +5777,7 @@ yyreduce: break; case 286: -#line 3131 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3148 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *DstTy = (yyvsp[0].TypeVal).T->get(); if (!DstTy->isFirstClassType()) @@ -5773,7 +5790,7 @@ yyreduce: break; case 287: -#line 3140 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3157 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-4].ValueVal).V->getType()->isInteger() || cast((yyvsp[-4].ValueVal).V->getType())->getBitWidth() != 1) @@ -5786,7 +5803,7 @@ yyreduce: break; case 288: -#line 3149 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3166 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[0].TypeVal).T->get(); NewVarArgs = true; @@ -5797,7 +5814,7 @@ yyreduce: break; case 289: -#line 3156 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3173 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type* ArgTy = (yyvsp[-2].ValueVal).V->getType(); const Type* DstTy = (yyvsp[0].TypeVal).T->get(); @@ -5822,7 +5839,7 @@ yyreduce: break; case 290: -#line 3177 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3194 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type* ArgTy = (yyvsp[-2].ValueVal).V->getType(); const Type* DstTy = (yyvsp[0].TypeVal).T->get(); @@ -5850,7 +5867,7 @@ yyreduce: break; case 291: -#line 3201 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3218 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V)) error("Invalid extractelement operands"); @@ -5860,7 +5877,7 @@ yyreduce: break; case 292: -#line 3207 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3224 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal).V, (yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V)) error("Invalid insertelement operands"); @@ -5870,7 +5887,7 @@ yyreduce: break; case 293: -#line 3213 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3230 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal).V, (yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V)) error("Invalid shufflevector operands"); @@ -5880,7 +5897,7 @@ yyreduce: break; case 294: -#line 3219 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3236 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[0].PHIList).P->front().first->getType(); if (!Ty->isFirstClassType()) @@ -5900,7 +5917,7 @@ yyreduce: break; case 295: -#line 3235 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3252 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Handle the short call syntax @@ -5982,34 +5999,34 @@ yyreduce: break; case 296: -#line 3313 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3330 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.InstVal) = (yyvsp[0].InstVal); ;} break; case 297: -#line 3321 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3338 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValueList) = (yyvsp[0].ValueList); ;} break; case 298: -#line 3322 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3339 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValueList) = new std::vector(); ;} break; case 299: -#line 3326 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3343 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.BoolVal) = true; ;} break; case 300: -#line 3327 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3344 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.BoolVal) = false; ;} break; case 301: -#line 3331 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3348 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-1].TypeVal).T->get(); (yyval.InstVal).S = (yyvsp[-1].TypeVal).S; @@ -6019,7 +6036,7 @@ yyreduce: break; case 302: -#line 3337 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3354 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-4].TypeVal).T->get(); (yyval.InstVal).S = (yyvsp[-4].TypeVal).S; @@ -6029,7 +6046,7 @@ yyreduce: break; case 303: -#line 3343 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3360 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-1].TypeVal).T->get(); (yyval.InstVal).S = (yyvsp[-1].TypeVal).S; @@ -6039,7 +6056,7 @@ yyreduce: break; case 304: -#line 3349 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3366 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *Ty = (yyvsp[-4].TypeVal).T->get(); (yyval.InstVal).S = (yyvsp[-4].TypeVal).S; @@ -6049,7 +6066,7 @@ yyreduce: break; case 305: -#line 3355 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3372 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type *PTy = (yyvsp[0].ValueVal).V->getType(); if (!isa(PTy)) @@ -6060,7 +6077,7 @@ yyreduce: break; case 306: -#line 3362 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3379 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type* Ty = (yyvsp[-1].TypeVal).T->get(); (yyval.InstVal).S = (yyvsp[-1].TypeVal).S; @@ -6076,7 +6093,7 @@ yyreduce: break; case 307: -#line 3374 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3391 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal).T->get()); if (!PTy) @@ -6094,7 +6111,7 @@ yyreduce: break; case 308: -#line 3388 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3405 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const Type* Ty = (yyvsp[-2].TypeVal).T->get(); if (!isa(Ty)) @@ -6116,7 +6133,7 @@ yyreduce: } /* Line 1126 of yacc.c. */ -#line 6120 "UpgradeParser.tab.c" +#line 6137 "UpgradeParser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -6384,7 +6401,7 @@ yyreturn: } -#line 3404 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 3421 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" int yyerror(const char *ErrorMsg) { diff --git a/llvm/tools/llvm-upgrade/UpgradeParser.h.cvs b/llvm/tools/llvm-upgrade/UpgradeParser.h.cvs index 3603225afac9f23f52eaca20436685995826ba74..cf708c6bbe51c7fa2c5339a11c789ca128afc740 100644 --- a/llvm/tools/llvm-upgrade/UpgradeParser.h.cvs +++ b/llvm/tools/llvm-upgrade/UpgradeParser.h.cvs @@ -335,7 +335,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 1435 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1431 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; diff --git a/llvm/tools/llvm-upgrade/UpgradeParser.y b/llvm/tools/llvm-upgrade/UpgradeParser.y index 34ebd62a41337a2a6b12f8772ce1e94328d96f79..0f47b386ba7cbf1de6e5f27ce3b93c3c9cc8b6f0 100644 --- a/llvm/tools/llvm-upgrade/UpgradeParser.y +++ b/llvm/tools/llvm-upgrade/UpgradeParser.y @@ -17,7 +17,7 @@ #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/MathExtras.h" @@ -312,8 +312,10 @@ static Value *getExistingValue(const Type *Ty, const ValID &D) { LookupName = I->second; else LookupName = Name; - SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); - V = SymTab.lookup(Ty, LookupName); + ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); + V = SymTab.lookup(LookupName); + if (V && V->getType() != Ty) + V = 0; } if (!V) { RenameMapType::const_iterator I = CurModule.RenameMap.find(Key); @@ -322,9 +324,11 @@ static Value *getExistingValue(const Type *Ty, const ValID &D) { LookupName = I->second; else LookupName = Name; - V = CurModule.CurrentModule->getValueSymbolTable().lookup(Ty, LookupName); + V = CurModule.CurrentModule->getValueSymbolTable().lookup(LookupName); + if (V && V->getType() != Ty) + V = 0; } - if (V == 0) + if (!V) return 0; D.destroy(); // Free old strdup'd memory... @@ -416,7 +420,7 @@ static Value *getVal(const Type *Ty, const ValID &ID) { // Remember where this forward reference came from. FIXME, shouldn't we try // to recycle these things?? CurModule.PlaceHolderInfo.insert( - std::make_pair(V, std::make_pair(ID, Upgradelineno-1))); + std::make_pair(V, std::make_pair(ID, Upgradelineno))); if (inFunctionScope()) InsertValue(V, CurFun.LateResolveValues); @@ -448,7 +452,7 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { case ValID::NameVal: // Is it a named definition? Name = ID.Name; if (Value *N = CurFun.CurrentFunction-> - getValueSymbolTable().lookup(Type::LabelTy, Name)) { + getValueSymbolTable().lookup(Name)) { if (N->getType() != Type::LabelTy) error("Name '" + Name + "' does not refer to a BasicBlock"); BB = cast(N); @@ -682,16 +686,8 @@ static void setValueName(Value *V, char *NameStr) { assert(inFunctionScope() && "Must be in function scope"); // Search the function's symbol table for an existing value of this name - Value* Existing = 0; - SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); - SymbolTable::plane_const_iterator PI = ST.plane_begin(), PE =ST.plane_end(); - for ( ; PI != PE; ++PI) { - SymbolTable::value_const_iterator VI = PI->second.find(Name); - if (VI != PI->second.end()) { - Existing = VI->second; - break; - } - } + ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); + Value* Existing = ST.lookup(Name); if (Existing) { // An existing value of the same name was found. This might have happened // because of the integer type planes collapsing in LLVM 2.0. @@ -2561,27 +2557,27 @@ FunctionHeaderH if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy) error("LLVM functions cannot return aggregate types"); - std::vector ParamTypeList; + std::vector ParamTyList; // In LLVM 2.0 the signatures of three varargs intrinsics changed to take // i8*. We check here for those names and override the parameter list // types to ensure the prototype is correct. if (FunctionName == "llvm.va_start" || FunctionName == "llvm.va_end") { - ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::get(Type::Int8Ty)); } else if (FunctionName == "llvm.va_copy") { - ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); - ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::get(Type::Int8Ty)); } else if ($5) { // If there are arguments... for (std::vector >::iterator I = $5->begin(), E = $5->end(); I != E; ++I) { const Type *Ty = I->first.T->get(); - ParamTypeList.push_back(Ty); + ParamTyList.push_back(Ty); } } - bool isVarArg = - ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; - if (isVarArg) ParamTypeList.pop_back(); + bool isVarArg = ParamTyList.size() && ParamTyList.back() == Type::VoidTy; + if (isVarArg) + ParamTyList.pop_back(); // Convert the CSRet calling convention into the corresponding parameter // attribute. @@ -2591,7 +2587,7 @@ FunctionHeaderH ParamAttrs.push_back(FunctionType::StructRetAttribute); // first arg } - const FunctionType *FT = FunctionType::get(RetTy, ParamTypeList, isVarArg, + const FunctionType *FT = FunctionType::get(RetTy, ParamTyList, isVarArg, ParamAttrs); const PointerType *PFT = PointerType::get(FT); delete $2.T; @@ -2612,18 +2608,37 @@ FunctionHeaderH CurModule.CurrentModule->getFunctionList().remove(Fn); CurModule.CurrentModule->getFunctionList().push_back(Fn); } else if (!FunctionName.empty() && // Merge with an earlier prototype? - (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { - // If this is the case, either we need to be a forward decl, or it needs - // to be. - if (!CurFun.isDeclare && !Fn->isDeclaration()) - error("Redefinition of function '" + FunctionName + "'"); + (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { + if (Fn->getFunctionType() != FT ) { + // The existing function doesn't have the same type. Previously this was + // permitted because the symbol tables had "type planes" and names were + // distinct within a type plane. After PR411 was fixed, this is no + // longer the case. To resolve this we must rename this function. + // However, renaming it can cause problems if its linkage is external + // because it could cause a link failure. We warn about this. + std::string NewName = makeNameUnique(FunctionName); + warning("Renaming function '" + FunctionName + "' as '" + NewName + + "' may cause linkage errors"); + + Fn = new Function(FT, GlobalValue::ExternalLinkage, NewName, + CurModule.CurrentModule); + InsertValue(Fn, CurModule.Values); + RenameMapKey Key = std::make_pair(FunctionName,PFT); + CurModule.RenameMap[Key] = NewName; + } else { + // The types are the same. Either the existing or the current function + // needs to be a forward declaration. If not, they're attempting to + // redefine a function. + if (!CurFun.isDeclare && !Fn->isDeclaration()) + error("Redefinition of function '" + FunctionName + "'"); - // Make sure to strip off any argument names so we can't get conflicts. - if (Fn->isDeclaration()) - for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); - AI != AE; ++AI) - AI->setName(""); - } else { // Not already defined? + // Make sure to strip off any argument names so we can't get conflicts. + if (Fn->isDeclaration()) + for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); + AI != AE; ++AI) + AI->setName(""); + } + } else { // Not already defined? Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, CurModule.CurrentModule); @@ -2654,8 +2669,10 @@ FunctionHeaderH $5->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); - for (std::vector >::iterator - I = $5->begin(), E = $5->end(); I != E; ++I, ++ArgIt) { + Function::arg_iterator ArgEnd = Fn->arg_end(); + std::vector >::iterator I = $5->begin(); + std::vector >::iterator E = $5->end(); + for ( ; I != E && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->first.T; // Delete the typeholder... setValueName(ArgIt, I->second); // Insert arg into symtab... InsertValue(ArgIt); diff --git a/llvm/tools/llvm-upgrade/UpgradeParser.y.cvs b/llvm/tools/llvm-upgrade/UpgradeParser.y.cvs index 34ebd62a41337a2a6b12f8772ce1e94328d96f79..0f47b386ba7cbf1de6e5f27ce3b93c3c9cc8b6f0 100644 --- a/llvm/tools/llvm-upgrade/UpgradeParser.y.cvs +++ b/llvm/tools/llvm-upgrade/UpgradeParser.y.cvs @@ -17,7 +17,7 @@ #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/MathExtras.h" @@ -312,8 +312,10 @@ static Value *getExistingValue(const Type *Ty, const ValID &D) { LookupName = I->second; else LookupName = Name; - SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); - V = SymTab.lookup(Ty, LookupName); + ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); + V = SymTab.lookup(LookupName); + if (V && V->getType() != Ty) + V = 0; } if (!V) { RenameMapType::const_iterator I = CurModule.RenameMap.find(Key); @@ -322,9 +324,11 @@ static Value *getExistingValue(const Type *Ty, const ValID &D) { LookupName = I->second; else LookupName = Name; - V = CurModule.CurrentModule->getValueSymbolTable().lookup(Ty, LookupName); + V = CurModule.CurrentModule->getValueSymbolTable().lookup(LookupName); + if (V && V->getType() != Ty) + V = 0; } - if (V == 0) + if (!V) return 0; D.destroy(); // Free old strdup'd memory... @@ -416,7 +420,7 @@ static Value *getVal(const Type *Ty, const ValID &ID) { // Remember where this forward reference came from. FIXME, shouldn't we try // to recycle these things?? CurModule.PlaceHolderInfo.insert( - std::make_pair(V, std::make_pair(ID, Upgradelineno-1))); + std::make_pair(V, std::make_pair(ID, Upgradelineno))); if (inFunctionScope()) InsertValue(V, CurFun.LateResolveValues); @@ -448,7 +452,7 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { case ValID::NameVal: // Is it a named definition? Name = ID.Name; if (Value *N = CurFun.CurrentFunction-> - getValueSymbolTable().lookup(Type::LabelTy, Name)) { + getValueSymbolTable().lookup(Name)) { if (N->getType() != Type::LabelTy) error("Name '" + Name + "' does not refer to a BasicBlock"); BB = cast(N); @@ -682,16 +686,8 @@ static void setValueName(Value *V, char *NameStr) { assert(inFunctionScope() && "Must be in function scope"); // Search the function's symbol table for an existing value of this name - Value* Existing = 0; - SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); - SymbolTable::plane_const_iterator PI = ST.plane_begin(), PE =ST.plane_end(); - for ( ; PI != PE; ++PI) { - SymbolTable::value_const_iterator VI = PI->second.find(Name); - if (VI != PI->second.end()) { - Existing = VI->second; - break; - } - } + ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); + Value* Existing = ST.lookup(Name); if (Existing) { // An existing value of the same name was found. This might have happened // because of the integer type planes collapsing in LLVM 2.0. @@ -2561,27 +2557,27 @@ FunctionHeaderH if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy) error("LLVM functions cannot return aggregate types"); - std::vector ParamTypeList; + std::vector ParamTyList; // In LLVM 2.0 the signatures of three varargs intrinsics changed to take // i8*. We check here for those names and override the parameter list // types to ensure the prototype is correct. if (FunctionName == "llvm.va_start" || FunctionName == "llvm.va_end") { - ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::get(Type::Int8Ty)); } else if (FunctionName == "llvm.va_copy") { - ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); - ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::get(Type::Int8Ty)); } else if ($5) { // If there are arguments... for (std::vector >::iterator I = $5->begin(), E = $5->end(); I != E; ++I) { const Type *Ty = I->first.T->get(); - ParamTypeList.push_back(Ty); + ParamTyList.push_back(Ty); } } - bool isVarArg = - ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; - if (isVarArg) ParamTypeList.pop_back(); + bool isVarArg = ParamTyList.size() && ParamTyList.back() == Type::VoidTy; + if (isVarArg) + ParamTyList.pop_back(); // Convert the CSRet calling convention into the corresponding parameter // attribute. @@ -2591,7 +2587,7 @@ FunctionHeaderH ParamAttrs.push_back(FunctionType::StructRetAttribute); // first arg } - const FunctionType *FT = FunctionType::get(RetTy, ParamTypeList, isVarArg, + const FunctionType *FT = FunctionType::get(RetTy, ParamTyList, isVarArg, ParamAttrs); const PointerType *PFT = PointerType::get(FT); delete $2.T; @@ -2612,18 +2608,37 @@ FunctionHeaderH CurModule.CurrentModule->getFunctionList().remove(Fn); CurModule.CurrentModule->getFunctionList().push_back(Fn); } else if (!FunctionName.empty() && // Merge with an earlier prototype? - (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { - // If this is the case, either we need to be a forward decl, or it needs - // to be. - if (!CurFun.isDeclare && !Fn->isDeclaration()) - error("Redefinition of function '" + FunctionName + "'"); + (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { + if (Fn->getFunctionType() != FT ) { + // The existing function doesn't have the same type. Previously this was + // permitted because the symbol tables had "type planes" and names were + // distinct within a type plane. After PR411 was fixed, this is no + // longer the case. To resolve this we must rename this function. + // However, renaming it can cause problems if its linkage is external + // because it could cause a link failure. We warn about this. + std::string NewName = makeNameUnique(FunctionName); + warning("Renaming function '" + FunctionName + "' as '" + NewName + + "' may cause linkage errors"); + + Fn = new Function(FT, GlobalValue::ExternalLinkage, NewName, + CurModule.CurrentModule); + InsertValue(Fn, CurModule.Values); + RenameMapKey Key = std::make_pair(FunctionName,PFT); + CurModule.RenameMap[Key] = NewName; + } else { + // The types are the same. Either the existing or the current function + // needs to be a forward declaration. If not, they're attempting to + // redefine a function. + if (!CurFun.isDeclare && !Fn->isDeclaration()) + error("Redefinition of function '" + FunctionName + "'"); - // Make sure to strip off any argument names so we can't get conflicts. - if (Fn->isDeclaration()) - for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); - AI != AE; ++AI) - AI->setName(""); - } else { // Not already defined? + // Make sure to strip off any argument names so we can't get conflicts. + if (Fn->isDeclaration()) + for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); + AI != AE; ++AI) + AI->setName(""); + } + } else { // Not already defined? Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, CurModule.CurrentModule); @@ -2654,8 +2669,10 @@ FunctionHeaderH $5->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); - for (std::vector >::iterator - I = $5->begin(), E = $5->end(); I != E; ++I, ++ArgIt) { + Function::arg_iterator ArgEnd = Fn->arg_end(); + std::vector >::iterator I = $5->begin(); + std::vector >::iterator E = $5->end(); + for ( ; I != E && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->first.T; // Delete the typeholder... setValueName(ArgIt, I->second); // Insert arg into symtab... InsertValue(ArgIt); diff --git a/llvm/tools/llvm2cpp/CppWriter.cpp b/llvm/tools/llvm2cpp/CppWriter.cpp index d0a02bfa0e4076e8732392e6770364fac8c9ebe3..e7d1185855e82c02333336f1c8b2dd513f960361 100644 --- a/llvm/tools/llvm2cpp/CppWriter.cpp +++ b/llvm/tools/llvm2cpp/CppWriter.cpp @@ -19,7 +19,6 @@ #include "llvm/Instruction.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" #include "llvm/TypeSymbolTable.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp index f3688b4702748d69d65b4e2b462a609815369873..d7dec3f7fa179c1e07ff1e8c8a7626e959c1dd5e 100644 --- a/llvm/tools/lto/lto.cpp +++ b/llvm/tools/lto/lto.cpp @@ -17,7 +17,6 @@ #include "llvm/Linker.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" -#include "llvm/SymbolTable.h" #include "llvm/Bytecode/Reader.h" #include "llvm/Bytecode/Writer.h" #include "llvm/Support/CommandLine.h" @@ -248,12 +247,6 @@ LTO::optimize(Module *M, std::ostream &Out, // Add an appropriate TargetData instance for this module... Passes.add(new TargetData(*Target->getTargetData())); - // Often if the programmer does not specify proper prototypes for the - // functions they are calling, they end up calling a vararg version of the - // function that does not get a body filled in (the real function has typed - // arguments). This pass merges the two functions. - Passes.add(createFunctionResolvingPass()); - // Internalize symbols if export list is nonemty if (!exportList.empty()) Passes.add(createInternalizePass(exportList)); diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index 76cede13f6539558ca42473a5edc2eb64be45b8b..5294cac76b2aef60d73a33cf2d4d055e71cf94a9 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -178,7 +178,6 @@ void AddStandardCompilePasses(PassManager &PM) { PM.add(createVerifierPass()); // Verify that input is correct addPass(PM, createLowerSetJmpPass()); // Lower llvm.setjmp/.longjmp - addPass(PM, createFunctionResolvingPass()); // Resolve (...) functions // If the -strip-debug command line option was specified, do it. if (StripDebug) diff --git a/stacker/lib/compiler/StackerParser.cpp.cvs b/stacker/lib/compiler/StackerParser.cpp.cvs index 551e851d7661766da7decb3d32a8bc80106afa72..ba2b10f023158549fbe03d009db07b307c990911 100644 --- a/stacker/lib/compiler/StackerParser.cpp.cvs +++ b/stacker/lib/compiler/StackerParser.cpp.cvs @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875c. */ +/* A Bison parser, made by GNU Bison 2.1. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -36,6 +36,9 @@ /* Identify Bison output. */ #define YYBISON 1 +/* Bison version. */ +#define YYBISON_VERSION "2.1" + /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -45,8 +48,7 @@ /* Using locations. */ #define YYLSP_NEEDED 0 -/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +/* Substitute the variable and function names. */ #define yyparse Stackerparse #define yylex Stackerlex #define yyerror Stackererror @@ -137,6 +139,7 @@ OUT_CHAR = 330 }; #endif +/* Tokens. */ #define INTEGER 258 #define STRING 259 #define IDENTIFIER 260 @@ -215,10 +218,9 @@ /* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" +#line 14 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" #include "StackerCompiler.h" -#include "llvm/SymbolTable.h" #include "llvm/Module.h" #include "llvm/Instructions.h" #include "llvm/ADT/STLExtras.h" @@ -249,8 +251,13 @@ int yyparse(); # define YYERROR_VERBOSE 0 #endif +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 35 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" +#line 34 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" typedef union YYSTYPE { llvm::Module* ModuleVal; llvm::Function* FunctionVal; @@ -258,8 +265,8 @@ typedef union YYSTYPE { int64_t IntegerVal; char* StringVal; } YYSTYPE; -/* Line 191 of yacc.c. */ -#line 263 "StackerParser.tab.c" +/* Line 196 of yacc.c. */ +#line 270 "StackerParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -270,30 +277,49 @@ typedef union YYSTYPE { /* Copy the second part of user declarations. */ -/* Line 214 of yacc.c. */ -#line 275 "StackerParser.tab.c" +/* Line 219 of yacc.c. */ +#line 282 "StackerParser.tab.c" -#if ! defined (yyoverflow) || YYERROR_VERBOSE +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif -# ifndef YYFREE -# define YYFREE free +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif # endif -# ifndef YYMALLOC -# define YYMALLOC malloc +# ifndef YY_ +# define YY_(msgid) msgid # endif +#endif + +#if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# else +# define YYSTACK_ALLOC alloca +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYINCLUDED_STDLIB_H +# endif # endif # endif # endif @@ -301,13 +327,39 @@ typedef union YYSTYPE { # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ # endif +# else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# endif +# ifdef __cplusplus +extern "C" { +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifdef __cplusplus +} +# endif # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ @@ -319,7 +371,7 @@ typedef union YYSTYPE { /* A type that is properly aligned for any stack member. */ union yyalloc { - short yyss; + short int yyss; YYSTYPE yyvs; }; @@ -329,7 +381,7 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do @@ -342,7 +394,7 @@ union yyalloc # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ @@ -371,7 +423,7 @@ union yyalloc #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else - typedef short yysigned_char; + typedef short int yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ @@ -392,7 +444,7 @@ union yyalloc #define YYUNDEFTOK 2 #define YYMAXUTOK 330 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ @@ -476,20 +528,20 @@ static const yysigned_char yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned char yyrline[] = { - 0, 70, 70, 70, 74, 75, 78, 79, 80, 83, - 86, 89, 92, 93, 99, 100, 101, 104, 105, 106, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169 + 0, 69, 69, 69, 73, 74, 77, 78, 79, 82, + 85, 88, 91, 92, 98, 99, 100, 103, 104, 105, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168 }; #endif -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { @@ -511,7 +563,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short yytoknum[] = +static const unsigned short int yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -578,7 +630,7 @@ static const yysigned_char yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -4 -static const short yypact[] = +static const short int yypact[] = { -4, 4, -4, -4, -2, 141, 52, -4, -4, -4, -4, -4, -4, 54, -3, 70, -4, -4, -4, -4, @@ -593,7 +645,7 @@ static const short yypact[] = }; /* YYPGOTO[NTERM-NUM]. */ -static const short yypgoto[] = +static const short int yypgoto[] = { -4, -4, -4, -4, -4, -4, -4, -4, 135, -4 }; @@ -659,22 +711,6 @@ static const unsigned char yystos[] = 63, 5, 61 }; -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -704,26 +740,59 @@ do \ goto yybackup; \ } \ else \ - { \ - yyerror ("syntax error: cannot back up");\ + { \ + yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) + #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).first_line = (Rhs)[1].first_line, \ - (Current).first_column = (Rhs)[1].first_column, \ - (Current).last_line = (Rhs)[N].last_line, \ - (Current).last_column = (Rhs)[N].last_column) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) #endif + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM @@ -746,19 +815,13 @@ do { \ YYFPRINTF Args; \ } while (0) -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) - -# define YYDSYMPRINTF(Title, Token, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Token, Value); \ + yysymprint (stderr, \ + Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) @@ -770,12 +833,12 @@ do { \ #if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (short *bottom, short *top) +yy_stack_print (short int *bottom, short int *top) #else static void yy_stack_print (bottom, top) - short *bottom; - short *top; + short int *bottom; + short int *top; #endif { YYFPRINTF (stderr, "Stack now"); @@ -805,13 +868,13 @@ yy_reduce_print (yyrule) #endif { int yyi; - unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); } # define YY_REDUCE_PRINT(Rule) \ @@ -825,8 +888,7 @@ do { \ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -841,13 +903,9 @@ int yydebug; if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -869,7 +927,7 @@ yystrlen (yystr) const char *yystr; # endif { - register const char *yys = yystr; + const char *yys = yystr; while (*yys++ != '\0') continue; @@ -894,8 +952,8 @@ yystpcpy (yydest, yysrc) const char *yysrc; # endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -905,7 +963,55 @@ yystpcpy (yydest, yysrc) # endif # endif -#endif /* !YYERROR_VERBOSE */ +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +#endif /* YYERROR_VERBOSE */ @@ -929,15 +1035,15 @@ yysymprint (yyoutput, yytype, yyvaluep) (void) yyvaluep; if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - } + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif switch (yytype) { default: @@ -953,10 +1059,11 @@ yysymprint (yyoutput, yytype, yyvaluep) #if defined (__STDC__) || defined (__cplusplus) static void -yydestruct (int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yytype, yyvaluep) +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif @@ -964,6 +1071,10 @@ yydestruct (yytype, yyvaluep) /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + switch (yytype) { @@ -991,10 +1102,10 @@ int yyparse (); -/* The lookahead symbol. */ +/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1025,12 +1136,12 @@ yyparse () #endif { - register int yystate; - register int yyn; + int yystate; + int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: @@ -1042,14 +1153,14 @@ yyparse () to reallocate them elsewhere. */ /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + YYSTYPE *yyvsp; @@ -1106,14 +1217,14 @@ yyparse () these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + short int *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", + yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), @@ -1124,21 +1235,21 @@ yyparse () } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - short *yyss1 = yyss; + short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyoverflowlab; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); @@ -1170,18 +1281,18 @@ yyparse () yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1196,7 +1307,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -1216,8 +1327,8 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -1267,405 +1378,406 @@ yyreduce: switch (yyn) { case 2: -#line 70 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" +#line 69 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" { SCI->handle_module_start( ); ;} break; case 3: -#line 71 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.ModuleVal = SCI->handle_module_end( yyvsp[0].ModuleVal ); ;} +#line 70 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.ModuleVal) = SCI->handle_module_end( (yyvsp[0].ModuleVal) ); ;} break; case 4: -#line 74 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.ModuleVal = SCI->handle_definition_list_end( yyvsp[-1].ModuleVal, yyvsp[0].FunctionVal ); ;} +#line 73 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.ModuleVal) = SCI->handle_definition_list_end( (yyvsp[-1].ModuleVal), (yyvsp[0].FunctionVal) ); ;} break; case 5: -#line 75 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.ModuleVal = SCI->handle_definition_list_start(); ;} +#line 74 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.ModuleVal) = SCI->handle_definition_list_start(); ;} break; case 6: -#line 78 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.FunctionVal = yyvsp[0].FunctionVal; ;} +#line 77 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.FunctionVal) = (yyvsp[0].FunctionVal); ;} break; case 7: -#line 79 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.FunctionVal = yyvsp[0].FunctionVal; ;} +#line 78 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.FunctionVal) = (yyvsp[0].FunctionVal); ;} break; case 8: -#line 80 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.FunctionVal = yyvsp[0].FunctionVal; ;} +#line 79 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.FunctionVal) = (yyvsp[0].FunctionVal); ;} break; case 9: -#line 83 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.FunctionVal = SCI->handle_forward( yyvsp[-1].StringVal ); ;} +#line 82 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.FunctionVal) = SCI->handle_forward( (yyvsp[-1].StringVal) ); ;} break; case 10: -#line 86 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.FunctionVal = SCI->handle_main_definition(yyvsp[-1].FunctionVal); ;} +#line 85 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.FunctionVal) = SCI->handle_main_definition((yyvsp[-1].FunctionVal)); ;} break; case 11: -#line 89 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.FunctionVal = SCI->handle_definition( yyvsp[-2].StringVal, yyvsp[-1].FunctionVal ); ;} +#line 88 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.FunctionVal) = SCI->handle_definition( (yyvsp[-2].StringVal), (yyvsp[-1].FunctionVal) ); ;} break; case 12: -#line 92 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.FunctionVal = SCI->handle_word_list_end( yyvsp[-1].FunctionVal, yyvsp[0].BasicBlockVal ); ;} +#line 91 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.FunctionVal) = SCI->handle_word_list_end( (yyvsp[-1].FunctionVal), (yyvsp[0].BasicBlockVal) ); ;} break; case 13: -#line 93 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.FunctionVal = SCI->handle_word_list_start(); ;} +#line 92 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.FunctionVal) = SCI->handle_word_list_start(); ;} break; case 14: -#line 99 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_if( yyvsp[-3].StringVal, yyvsp[-1].StringVal ); ;} +#line 98 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_if( (yyvsp[-3].StringVal), (yyvsp[-1].StringVal) ); ;} break; case 15: -#line 100 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_if( yyvsp[-1].StringVal ); ;} +#line 99 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_if( (yyvsp[-1].StringVal) ); ;} break; case 16: -#line 101 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_while( yyvsp[-1].StringVal ); ;} +#line 100 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_while( (yyvsp[-1].StringVal) ); ;} break; case 17: -#line 104 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_identifier( yyvsp[0].StringVal ); ;} +#line 103 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_identifier( (yyvsp[0].StringVal) ); ;} break; case 18: -#line 105 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_string( yyvsp[0].StringVal ); ;} +#line 104 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_string( (yyvsp[0].StringVal) ); ;} break; case 19: -#line 106 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_integer( yyvsp[0].IntegerVal ); ;} +#line 105 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_integer( (yyvsp[0].IntegerVal) ); ;} break; case 20: -#line 109 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( TRUETOK ); ;} +#line 108 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( TRUETOK ); ;} break; case 21: -#line 110 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( FALSETOK ); ;} +#line 109 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( FALSETOK ); ;} break; case 22: -#line 111 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( LESS ); ;} +#line 110 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( LESS ); ;} break; case 23: -#line 112 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( MORE ); ;} +#line 111 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( MORE ); ;} break; case 24: -#line 113 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( LESS_EQUAL ); ;} +#line 112 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( LESS_EQUAL ); ;} break; case 25: -#line 114 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( MORE_EQUAL ); ;} +#line 113 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( MORE_EQUAL ); ;} break; case 26: -#line 115 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( NOT_EQUAL ); ;} +#line 114 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( NOT_EQUAL ); ;} break; case 27: -#line 116 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( EQUAL ); ;} +#line 115 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( EQUAL ); ;} break; case 28: -#line 117 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( PLUS ); ;} +#line 116 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( PLUS ); ;} break; case 29: -#line 118 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( MINUS ); ;} +#line 117 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( MINUS ); ;} break; case 30: -#line 119 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( INCR ); ;} +#line 118 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( INCR ); ;} break; case 31: -#line 120 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( DECR ); ;} +#line 119 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( DECR ); ;} break; case 32: -#line 121 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( MULT ); ;} +#line 120 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( MULT ); ;} break; case 33: -#line 122 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( DIV ); ;} +#line 121 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( DIV ); ;} break; case 34: -#line 123 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( MODULUS ); ;} +#line 122 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( MODULUS ); ;} break; case 35: -#line 124 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( NEGATE ); ;} +#line 123 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( NEGATE ); ;} break; case 36: -#line 125 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( ABS ); ;} +#line 124 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( ABS ); ;} break; case 37: -#line 126 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( MIN ); ;} +#line 125 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( MIN ); ;} break; case 38: -#line 127 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( MAX ); ;} +#line 126 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( MAX ); ;} break; case 39: -#line 128 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( STAR_SLASH ); ;} +#line 127 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( STAR_SLASH ); ;} break; case 40: -#line 129 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( AND ); ;} +#line 128 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( AND ); ;} break; case 41: -#line 130 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( OR ); ;} +#line 129 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( OR ); ;} break; case 42: -#line 131 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( XOR ); ;} +#line 130 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( XOR ); ;} break; case 43: -#line 132 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( LSHIFT ); ;} +#line 131 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( LSHIFT ); ;} break; case 44: -#line 133 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( RSHIFT ); ;} +#line 132 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( RSHIFT ); ;} break; case 45: -#line 134 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( DROP ); ;} +#line 133 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( DROP ); ;} break; case 46: -#line 135 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( DROP2 ); ;} +#line 134 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( DROP2 ); ;} break; case 47: -#line 136 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( NIP ); ;} +#line 135 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( NIP ); ;} break; case 48: -#line 137 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( NIP2 ); ;} +#line 136 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( NIP2 ); ;} break; case 49: -#line 138 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( DUP ); ;} +#line 137 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( DUP ); ;} break; case 50: -#line 139 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( DUP2 ); ;} +#line 138 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( DUP2 ); ;} break; case 51: -#line 140 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( SWAP ); ;} +#line 139 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( SWAP ); ;} break; case 52: -#line 141 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( SWAP2 ); ;} +#line 140 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( SWAP2 ); ;} break; case 53: -#line 142 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( OVER ); ;} +#line 141 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( OVER ); ;} break; case 54: -#line 143 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( OVER2 ); ;} +#line 142 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( OVER2 ); ;} break; case 55: -#line 144 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( ROT ); ;} +#line 143 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( ROT ); ;} break; case 56: -#line 145 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( ROT2 ); ;} +#line 144 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( ROT2 ); ;} break; case 57: -#line 146 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( RROT ); ;} +#line 145 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( RROT ); ;} break; case 58: -#line 147 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( RROT2 ); ;} +#line 146 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( RROT2 ); ;} break; case 59: -#line 148 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( TUCK ); ;} +#line 147 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( TUCK ); ;} break; case 60: -#line 149 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( TUCK2 ); ;} +#line 148 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( TUCK2 ); ;} break; case 61: -#line 150 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( ROLL ); ;} +#line 149 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( ROLL ); ;} break; case 62: -#line 151 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( PICK ); ;} +#line 150 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( PICK ); ;} break; case 63: -#line 152 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( SELECT ); ;} +#line 151 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( SELECT ); ;} break; case 64: -#line 153 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( MALLOC ); ;} +#line 152 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( MALLOC ); ;} break; case 65: -#line 154 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( FREE ); ;} +#line 153 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( FREE ); ;} break; case 66: -#line 155 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( GET ); ;} +#line 154 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( GET ); ;} break; case 67: -#line 156 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( PUT ); ;} +#line 155 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( PUT ); ;} break; case 68: -#line 157 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( RECURSE ); ;} +#line 156 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( RECURSE ); ;} break; case 69: -#line 158 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( RETURN ); ;} +#line 157 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( RETURN ); ;} break; case 70: -#line 159 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( EXIT ); ;} +#line 158 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( EXIT ); ;} break; case 71: -#line 160 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( TAB ); ;} +#line 159 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( TAB ); ;} break; case 72: -#line 161 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( SPACE ); ;} +#line 160 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( SPACE ); ;} break; case 73: -#line 162 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( CR ); ;} +#line 161 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( CR ); ;} break; case 74: -#line 163 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( IN_STR ); ;} +#line 162 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( IN_STR ); ;} break; case 75: -#line 164 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( IN_NUM ); ;} +#line 163 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( IN_NUM ); ;} break; case 76: -#line 165 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( IN_CHAR ); ;} +#line 164 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( IN_CHAR ); ;} break; case 77: -#line 166 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( OUT_STR ); ;} +#line 165 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( OUT_STR ); ;} break; case 78: -#line 167 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( OUT_NUM ); ;} +#line 166 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( OUT_NUM ); ;} break; case 79: -#line 168 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( OUT_CHAR ); ;} +#line 167 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( OUT_CHAR ); ;} break; case 80: -#line 169 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" - { yyval.BasicBlockVal = SCI->handle_word( DUMP ); ;} +#line 168 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" + { (yyval.BasicBlockVal) = SCI->handle_word( DUMP ); ;} break; + default: break; } -/* Line 1000 of yacc.c. */ -#line 1669 "StackerParser.tab.c" +/* Line 1126 of yacc.c. */ +#line 1781 "StackerParser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -1704,12 +1816,36 @@ yyerrlab: if (YYPACT_NINF < yyn && yyn < YYLAST) { - YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); - const char* yyprefix; - char *yymsg; + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + char *yymsg = 0; +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; +#if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +#endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; @@ -1717,81 +1853,91 @@ yyerrlab: /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); - yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); - yycount += 1; - if (yycount == 5) + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { - yysize = 0; + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; break; } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); - if (yycount < 5) + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yyp = yystpcpy (yyp, yyprefix); - yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; - } + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else - yyerror ("syntax error; also virtual memory exhausted"); + { + yyerror (YY_("syntax error")); + goto yyexhaustedlab; + } } else #endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); + yyerror (YY_("syntax error")); } if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ + /* Return failure if at end of input. */ if (yychar == YYEOF) - for (;;) - { - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - } + YYABORT; } else { - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); + yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; - } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1801,14 +1947,13 @@ yyerrlab: `---------------------------------------------------*/ yyerrorlab: -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ if (0) goto yyerrorlab; -#endif - yyvsp -= yylen; +yyvsp -= yylen; yyssp -= yylen; yystate = *yyssp; goto yyerrlab1; @@ -1838,8 +1983,8 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp); + + yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1848,11 +1993,12 @@ yyerrlab1: if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval; + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + yystate = yyn; goto yynewstate; @@ -1872,16 +2018,25 @@ yyabortlab: goto yyreturn; #ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK; + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); @@ -1890,7 +2045,7 @@ yyreturn: } -#line 171 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" +#line 170 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" /* Handle messages a little more nicely than the default yyerror */ diff --git a/stacker/lib/compiler/StackerParser.h.cvs b/stacker/lib/compiler/StackerParser.h.cvs index 4fdc344c3f0e023d78deec452f61e7beff82ea28..afa4d51ef11607ae0758b5a36340eff7df0695de 100644 --- a/stacker/lib/compiler/StackerParser.h.cvs +++ b/stacker/lib/compiler/StackerParser.h.cvs @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875c. */ +/* A Bison parser, made by GNU Bison 2.1. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -104,6 +104,7 @@ OUT_CHAR = 330 }; #endif +/* Tokens. */ #define INTEGER 258 #define STRING 259 #define IDENTIFIER 260 @@ -182,7 +183,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 35 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" +#line 34 "/proj/llvm/llvm-3/projects/llvm-stacker/lib/compiler/StackerParser.y" typedef union YYSTYPE { llvm::Module* ModuleVal; llvm::Function* FunctionVal; @@ -190,8 +191,8 @@ typedef union YYSTYPE { int64_t IntegerVal; char* StringVal; } YYSTYPE; -/* Line 1275 of yacc.c. */ -#line 195 "StackerParser.tab.h" +/* Line 1447 of yacc.c. */ +#line 196 "StackerParser.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 diff --git a/stacker/lib/compiler/StackerParser.y b/stacker/lib/compiler/StackerParser.y index 40411d962804b7447c4ee54df9ac580bc819a405..e85db184a61409729ab187f403b63172f22aeec6 100644 --- a/stacker/lib/compiler/StackerParser.y +++ b/stacker/lib/compiler/StackerParser.y @@ -13,7 +13,6 @@ %{ #include "StackerCompiler.h" -#include "llvm/SymbolTable.h" #include "llvm/Module.h" #include "llvm/Instructions.h" #include "llvm/ADT/STLExtras.h" diff --git a/stacker/lib/compiler/StackerParser.y.cvs b/stacker/lib/compiler/StackerParser.y.cvs index 40411d962804b7447c4ee54df9ac580bc819a405..e85db184a61409729ab187f403b63172f22aeec6 100644 --- a/stacker/lib/compiler/StackerParser.y.cvs +++ b/stacker/lib/compiler/StackerParser.y.cvs @@ -13,7 +13,6 @@ %{ #include "StackerCompiler.h" -#include "llvm/SymbolTable.h" #include "llvm/Module.h" #include "llvm/Instructions.h" #include "llvm/ADT/STLExtras.h"