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
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(
unsigned Opcode, ///< Opcode of the instruction
const Type* iType, ///< Instruction type
std::vector<unsigned>& Operands, ///< Vector of slot # operands
+ Instruction *Inst, ///< The resulting instruction
unsigned Length ///< Length of instruction in bc bytes
) { return false; }
BasicBlockListType BasicBlocks; // The basic blocks
ArgumentListType ArgumentList; // The formal arguments
- SymbolTable *SymTab;
+ ValueSymbolTable *SymTab;
unsigned CallingConvention;
friend class SymbolTableListTraits<Function, Module, Module>;
/// 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; }
//===--------------------------------------------------------------------===//
(void) llvm::createEmitFunctionTablePass();
(void) llvm::createFunctionInliningPass();
(void) llvm::createFunctionProfilerPass();
- (void) llvm::createFunctionResolvingPass();
(void) llvm::createGCSEPass();
(void) llvm::createGlobalDCEPass();
(void) llvm::createGlobalOptimizerPass();
class GlobalVariable;
class GlobalValueRefMap; // Used by ConstantVals.cpp
class FunctionType;
-class SymbolTable;
-class TypeSymbolTable;
template<> struct ilist_traits<Function>
: public SymbolTableListTraits<Function, Module, Module> {
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
/// 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
/// 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
/// 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
+++ /dev/null
-//===-- 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 <map>
-
-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<const std::string, Value *> 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<const Type *, ValueMap> 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
-
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.
///
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<BasicBlock*> &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
class Function;
class GlobalVariable;
class InlineAsm;
-class SymbolTable;
+class ValueSymbolTable;
+class TypeSymbolTable;
//===----------------------------------------------------------------------===//
// Value Class
/// @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
/// 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
#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++ -*--===//
//
//
//===----------------------------------------------------------------------===*/
#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 <list>
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"
{ /* 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)
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 %
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 @
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);
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);
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
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
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
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;
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)
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)
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!
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"
return 0;
}
#endif
-#line 409 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 409 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
/* 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"
std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
std::map<const Type*, ValueList> 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;
// Module constants occupy the lowest numbered slots...
std::map<const Type*,ValueList>::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;
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<BasicBlock>(N);
break;
}
}
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;
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.
#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;
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
/* 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__
/* 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
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
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
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
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
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");
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)))
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)))
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] == '\\')
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));
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");
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
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
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");
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
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
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<const Type*> Params;
std::vector<FunctionType::ParameterAttributes> Attrs;
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<const Type*> Params;
std::vector<FunctionType::ParameterAttributes> Attrs;
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);
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))
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<const Type*> Elements;
for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
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<const Type*>()));
CHECK_FOR_ERROR
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<const Type*> Elements;
for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
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<const Type*>(), true));
CHECK_FOR_ERROR
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);
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());
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));
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
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;
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;
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
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<PATypeHolder>();
(yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
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
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());
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());
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());
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());
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<StructType>((yyvsp[-3].TypeVal)->get());
if (STy == 0)
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());
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<StructType>((yyvsp[-5].TypeVal)->get());
if (STy == 0)
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());
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());
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());
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());
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());
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());
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");
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");
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<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
(yyval.ConstVal) = ConstantInt::getTrue();
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<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
(yyval.ConstVal) = ConstantInt::getFalse();
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");
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());
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<PointerType>((yyvsp[-2].ConstVal)->getType()))
GEN_ERROR("GetElementPtr requires a pointer operand");
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");
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");
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");
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");
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");
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");
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");
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");
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
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<Constant*>();
(yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
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();
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();
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
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()) {
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());
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));
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)
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");
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());
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
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);
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));
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));
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));
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));
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());
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());
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
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;
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;
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
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));
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);
// 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++;
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;
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
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));
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
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
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
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
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
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
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
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
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
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
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();
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
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);
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
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
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
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
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());
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
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
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);
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<CastInst>((yyvsp[0].InstVal)))
if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
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
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
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
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
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
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<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
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
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
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
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
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
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<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
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<std::pair<Constant*, BasicBlock*> >();
Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
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());
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));
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());
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());
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<Value*>(); ;}
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));
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
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
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());
((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));
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());
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());
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());
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());
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");
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());
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");
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");
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");
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())
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
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
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
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
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());
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());
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());
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());
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<PointerType>((yyvsp[0].ValueVal)->getType()))
GEN_ERROR("Trying to free nonpointer type " +
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());
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());
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());
}
/* Line 1126 of yacc.c. */
-#line 5569 "llvmAsmParser.tab.c"
+#line 5588 "llvmAsmParser.tab.c"
\f
yyvsp -= yylen;
yyssp -= yylen;
}
-#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
std::string where
= std::string((CurFilename == "-") ? std::string("<stdin>") : 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;
}
#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;
#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"
std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
std::map<const Type*, ValueList> 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;
// Module constants occupy the lowest numbered slots...
std::map<const Type*,ValueList>::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;
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<BasicBlock>(N);
break;
}
}
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;
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.
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);
// 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++;
setValueName($3, $2);
CHECK_FOR_ERROR
InsertValue($3);
-
$1->getInstList().push_back($3);
InsertValue($1);
$$ = $1;
};
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())
($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);
std::string where
= std::string((CurFilename == "-") ? std::string("<stdin>") : 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;
}
#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"
std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
std::map<const Type*, ValueList> 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;
// Module constants occupy the lowest numbered slots...
std::map<const Type*,ValueList>::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;
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<BasicBlock>(N);
break;
}
}
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;
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.
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);
// 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++;
setValueName($3, $2);
CHECK_FOR_ERROR
InsertValue($3);
-
$1->getInstList().push_back($3);
InsertValue($1);
$$ = $1;
};
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())
($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);
std::string where
= std::string((CurFilename == "-") ? std::string("<stdin>") : 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;
}
*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,
<< " 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) {
}
virtual bool handleInstruction( unsigned Opcode, const Type* iType,
- std::vector<unsigned>& Operands, unsigned Size){
+ std::vector<unsigned>& 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++;
#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"
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);
}
// 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) {
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);
}
/// 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<BasicBlock*> BBMap;
} 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
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
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();
#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"
// 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);
}
// 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<Constant>(VI->second) &&
- !isa<GlobalValue>(VI->second))
- getOrCreateSlot(VI->second);
+ for (ValueSymbolTable::const_iterator VI = VST->begin(), VE = VST->end();
+ VI != VE; ++VI)
+ if (isa<Constant>(VI->second) && !isa<GlobalValue>(VI->second))
+ getOrCreateSlot(VI->second);
}
class Function;
class SymbolTable;
class TypeSymbolTable;
+class ValueSymbolTable;
class ConstantArray;
class SlotCalculator {
// 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();
#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"
}
}
-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<std::string, const Value*> PlaneMapEntry;
+ typedef std::vector<PlaneMapEntry> PlaneMapVector;
+ typedef std::map<const Type*, PlaneMapVector > 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
namespace llvm {
class InlineAsm;
class TypeSymbolTable;
+ class ValueSymbolTable;
class BytecodeWriter {
std::vector<unsigned char> &Out;
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<const Value*> &Plane,
unsigned StartNo);
#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"
static Value *RemapOperand(const Value *In,
std::map<const Value*, Value*> &ValueMap) {
std::map<const Value*,Value*>::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;
/// 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<GlobalValue>(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<GlobalValue>(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<Function>(SrcGV)) {
+ Function *DestF = cast<Function>(DestGV);
+ DestF->setCallingConv(SrcF->getCallingConv());
+ }
}
/// GetLinkageResult - This analyzes the two global values and determines what
static bool LinkGlobals(Module *Dest, Module *Src,
std::map<const Value*, Value*> &ValueMap,
std::multimap<std::string, GlobalVariable *> &AppendingVars,
- std::map<std::string, GlobalValue*> &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<std::string, GlobalValue*>::iterator EGV =
- GlobalsByName.find(SGV->getName());
- if (EGV != GlobalsByName.end())
- DGV = dyn_cast<GlobalVariable>(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;
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
"", 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));
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
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()));
//
static bool LinkFunctionProtos(Module *Dest, const Module *Src,
std::map<const Value*, Value*> &ValueMap,
- std::map<std::string,
- GlobalValue*> &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<std::string, GlobalValue*>::iterator EF =
- GlobalsByName.find(SF->getName());
- if (EF != GlobalsByName.end())
- DF = dyn_cast<Function>(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.
// ... 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));
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));
// 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!");
// 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<const Value*, Value*> &GlobalMap,
+ std::map<const Value*, Value*> &ValueMap,
std::string *Err) {
assert(Src && Dest && Dest->isDeclaration() && !Src->isDeclaration());
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.
for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end();
OI != OE; ++OI)
if (!isa<Instruction>(*OI) && !isa<BasicBlock>(*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;
}
Function *DF = cast<Function>(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;
// with appending linkage. After the module is linked together, they are
// appended and the module is rewritten.
std::multimap<std::string, GlobalVariable *> 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<std::string, GlobalValue*> 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
// 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
#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"
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();
// 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<const Type*>(1, Type::Int64Ty), false);
-
- const FunctionType *FreeType = // Get the type for free
- FunctionType::get(Type::VoidTy,
- std::vector<const Type*>(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<const Type*>(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<const Type*>(), 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<const Type*>(),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<const Type*>(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<const Type*>(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<const Type*>(), 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<const Type*>(),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<const Type*>(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<const Type*>(),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<const Type*>(),true);
+
+ if (TyWeHave != Free3Type) {
+ // Give up.
+ FreeFunc = 0;
+ }
+ }
+ }
}
// Don't mess with locally defined versions of these functions...
#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;
#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"
#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"
#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"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
+#include <map>
using namespace llvm;
//===----------------------------------------------------------------------===//
//
//===----------------------------------------------------------------------===//
//
-// This file implements the Function & GlobalVariable classes for the VMCore
-// library.
+// This file implements the Function class for the VMCore library.
//
//===----------------------------------------------------------------------===//
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!");
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
#include "llvm/GlobalVariable.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
#include "llvm/Support/LeakDetector.h"
using namespace llvm;
#include "llvm/Type.h"
#include "llvm/Instructions.h"
#include "llvm/Function.h"
-#include "llvm/SymbolTable.h"
#include "llvm/Support/LeakDetector.h"
using namespace llvm;
FunctionList.setParent(this);
GlobalList.setItemParent(this);
GlobalList.setParent(this);
- ValSymTab = new SymbolTable();
+ ValSymTab = new ValueSymbolTable();
TypeSymTab = new TypeSymbolTable();
}
// 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<Function>(SymTab.lookup(PointerType::get(Ty), Name));
+ // See if we have a definition for the specified function already.
+ Function *F = dyn_cast_or_null<Function>(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.
// 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);
}
// 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<Function>(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<const Type*> 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<Function*>(&(*I));
- return const_cast<Function*>(Found); // Non-external function not found...
+Function *Module::getFunction(const std::string &Name) const {
+ const ValueSymbolTable &SymTab = getValueSymbolTable();
+ return dyn_cast_or_null<Function>(SymTab.lookup(Name));
}
//===----------------------------------------------------------------------===//
/// 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<GlobalVariable>(V);
- if (AllowInternal || !Result->hasInternalLinkage())
+ bool AllowInternal) const {
+ if (Value *V = ValSymTab->lookup(Name)) {
+ GlobalVariable *Result = dyn_cast<GlobalVariable>(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<GlobalVariable*>(&(*I));
- return 0;
-}
-
-
-
//===----------------------------------------------------------------------===//
// Methods for easy access to the types in the module.
//
+++ /dev/null
-//===-- 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 <algorithm>
-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<Constant>(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<DerivedType>(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<DerivedType>(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<GlobalValue>(V) || cast<GlobalValue>(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<DerivedType>(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<const std::string, Value*> 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<GlobalValue>(VI->second);
- GlobalValue *NewGV = dyn_cast<GlobalValue>(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<Function>(NewGV))
- M->getFunctionList().remove(F);
- else
- M->getGlobalList().remove(cast<GlobalVariable>(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<const std::string, Value *> &V) {
- DOUT << " '" << V.first << "' = ";
- V.second->dump();
- DOUT << "\n";
-}
-
-static void DumpPlane(const std::pair<const Type *,
- std::map<const std::string, Value *> >&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
#define LLVM_SYMBOLTABLELISTTRAITS_IMPL_H
#include "llvm/SymbolTableListTraits.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
namespace llvm {
// Remove all of the items from the old symtab..
if (SymTabObject && !List.empty()) {
- SymbolTable &SymTab = SymTabObject->getValueSymbolTable();
+ ValueSymbolTable &SymTab = SymTabObject->getValueSymbolTable();
for (typename iplist<ValueSubClass>::iterator I = List.begin();
I != List.end(); ++I)
if (I->hasName()) SymTab.remove(I);
// Add all of the items to the new symtab...
if (SymTabObject && !List.empty()) {
- SymbolTable &SymTab = SymTabObject->getValueSymbolTable();
+ ValueSymbolTable &SymTab = SymTabObject->getValueSymbolTable();
for (typename iplist<ValueSubClass>::iterator I = List.begin();
I != List.end(); ++I)
if (I->hasName()) SymTab.insert(I);
#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"
#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 <algorithm>
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<Instruction>(this)) {
if (BasicBlock *P = I->getParent())
if (Function *PP = P->getParent())
ST = &PP->getValueSymbolTable();
} else if (BasicBlock *BB = dyn_cast<BasicBlock>(this)) {
- if (Function *P = BB->getParent()) ST = &P->getValueSymbolTable();
+ if (Function *P = BB->getParent())
+ ST = &P->getValueSymbolTable();
} else if (GlobalValue *GV = dyn_cast<GlobalValue>(this)) {
- if (Module *P = GV->getParent()) ST = &P->getValueSymbolTable();
+ if (Module *P = GV->getParent())
+ ST = &P->getValueSymbolTable();
} else if (Argument *A = dyn_cast<Argument>(this)) {
- if (Function *P = A->getParent()) ST = &P->getValueSymbolTable();
+ if (Function *P = A->getParent())
+ ST = &P->getValueSymbolTable();
} else {
assert(isa<Constant>(this) && "Unknown value type!");
return; // no name is setable for this.
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();
//
//===----------------------------------------------------------------------===//
+#define DEBUG_TYPE "valuesymtab"
#include "llvm/GlobalValue.h"
#include "llvm/Type.h"
#include "llvm/ValueSymbolTable.h"
#include <algorithm>
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<Constant>(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!");
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);
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;
#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"
// 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);
// 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.
%FunTy = type i28(i28)
declare i28 @"test"(...) ; Test differences of prototype
-declare i28 @"test"() ; Differ only by vararg
implementation
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
}
--- /dev/null
+; 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 }
+++ /dev/null
-Output
-*.log
-*.sum
+++ /dev/null
-; 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
-}
-
+++ /dev/null
-; 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
-}
-
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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
-}
-
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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
-
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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)
-
-
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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(...)
-
+++ /dev/null
-; 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
-}
+++ /dev/null
-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
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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
-}
#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"
// 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);
}
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();
// 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<BasicBlock>(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<BasicBlock>(V));
}
return true;
}
I->setLinkage(GlobalValue::ExternalLinkage);
std::vector<const PassInfo*> CleanupPasses;
- CleanupPasses.push_back(getPI(createFunctionResolvingPass()));
CleanupPasses.push_back(getPI(createGlobalDCEPass()));
CleanupPasses.push_back(getPI(createDeadTypeEliminationPass()));
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));
}
}
std::set<std::pair<std::string, const PointerType*> > 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!
}
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();
// 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);
}
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);
}
// 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
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;
// 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
#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++ -*--===//
//
//
//===----------------------------------------------------------------------===*/
#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 <list>
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"
{ /* 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 %
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);
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);
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
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
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;
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)
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
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!
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"
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"
/* 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"
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);
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...
// 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);
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<BasicBlock>(N);
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.
#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;
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
/* 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__
/* 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
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");
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");
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");
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)))
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)))
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] == '\\')
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));
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");
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;
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;
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());
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;
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;
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);
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");
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<const Type*> Params;
for (std::list<llvm::PATypeInfo>::iterator I = (yyvsp[-1].TypeList)->begin(),
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))));
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))
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<const Type*> Elements;
for (std::list<llvm::PATypeInfo>::iterator I = (yyvsp[-1].TypeList)->begin(),
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<const Type*>()));
(yyval.TypeVal).S = Signless;
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<const Type*> Elements;
for (std::list<llvm::PATypeInfo>::iterator I = (yyvsp[-2].TypeList)->begin(),
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<const Type*>(),true));
(yyval.TypeVal).S = Signless;
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");
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<PATypeInfo>();
(yyval.TypeList)->push_back((yyvsp[0].TypeVal));
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);
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>();
PATypeInfo VoidTI;
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<PATypeInfo>();
;}
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<ArrayType>((yyvsp[-3].TypeVal).T->get());
if (ATy == 0)
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<ArrayType>((yyvsp[-2].TypeVal).T->get());
if (ATy == 0)
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<ArrayType>((yyvsp[-2].TypeVal).T->get());
if (ATy == 0)
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<PackedType>((yyvsp[-3].TypeVal).T->get());
if (PTy == 0)
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<StructType>((yyvsp[-3].TypeVal).T->get());
if (STy == 0)
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<StructType>((yyvsp[-2].TypeVal).T->get());
if (STy == 0)
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<StructType>((yyvsp[-5].TypeVal).T->get());
if (STy == 0)
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<StructType>((yyvsp[-4].TypeVal).T->get());
if (STy == 0)
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<PointerType>((yyvsp[-1].TypeVal).T->get());
if (PTy == 0)
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;
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<PointerType>((yyvsp[-1].TypeVal).T->get());
if (Ty == 0)
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");
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<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
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)))
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)))
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;
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;
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");
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();
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<PointerType>(Ty))
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<IntegerType>((yyvsp[-5].ConstVal).C->getType())->getBitWidth() != 1)
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())
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())
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())
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");
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");
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<IntegerType>((yyvsp[-1].ConstVal).C->getType())->getBitWidth() != 8)
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");
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");
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");
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<ConstInfo>();
(yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
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();
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.
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:
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");
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);
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);
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 =
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);
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);
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));
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));
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));
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));
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");
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));
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<std::pair<PATypeInfo,char*> >();
(yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
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;
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<std::pair<PATypeInfo,char*> >();
PATypeInfo VoidTI;
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));
if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy)
error("LLVM functions cannot return aggregate types");
- std::vector<const Type*> ParamTypeList;
+ std::vector<const Type*> 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<std::pair<PATypeInfo,char*> >::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.
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;
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);
(yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
}
Function::arg_iterator ArgIt = Fn->arg_begin();
- for (std::vector<std::pair<PATypeInfo,char*> >::iterator
- I = (yyvsp[-3].ArgList)->begin(), E = (yyvsp[-3].ArgList)->end(); I != E; ++I, ++ArgIt) {
+ Function::arg_iterator ArgEnd = Fn->arg_end();
+ std::vector<std::pair<PATypeInfo,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
+ std::vector<std::pair<PATypeInfo,char*> >::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);
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;
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();
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();
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);
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;
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));
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);
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
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
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);
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));
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));
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));
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;
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<Constant>(getExistingValue((yyvsp[-4].PrimType).T, (yyvsp[-3].ValIDVal)));
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<std::pair<Constant*, BasicBlock*> >();
Constant *V = cast<Constant>(getExistingValue((yyvsp[-4].PrimType).T, (yyvsp[-3].ValIDVal)));
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))
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<std::pair<Value*, BasicBlock*> >();
(yyval.PHIList).S = (yyvsp[-5].TypeVal).S;
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));
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<ValueInfo>();
(yyval.ValueList)->push_back((yyvsp[0].ValueVal));
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));
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<PackedType>(Ty))
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()) {
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<PackedType>(Ty))
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<PackedType>(Ty))
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<PackedType>(Ty))
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();
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<IntegerType>((yyvsp[0].ValueVal).V->getType())->getBitWidth() != 8)
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())
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<IntegerType>((yyvsp[-4].ValueVal).V->getType())->getBitWidth() != 1)
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;
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();
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();
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");
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");
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");
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())
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
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<ValueInfo>(); ;}
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;
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;
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;
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;
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<PointerType>(PTy))
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;
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<PointerType>((yyvsp[-1].TypeVal).T->get());
if (!PTy)
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<PointerType>(Ty))
}
/* Line 1126 of yacc.c. */
-#line 6120 "UpgradeParser.tab.c"
+#line 6137 "UpgradeParser.tab.c"
\f
yyvsp -= yylen;
yyssp -= yylen;
}
-#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) {
#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;
#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"
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);
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...
// 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);
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<BasicBlock>(N);
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.
if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy)
error("LLVM functions cannot return aggregate types");
- std::vector<const Type*> ParamTypeList;
+ std::vector<const Type*> 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<std::pair<PATypeInfo,char*> >::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.
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;
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);
$5->pop_back(); // Delete the last entry
}
Function::arg_iterator ArgIt = Fn->arg_begin();
- for (std::vector<std::pair<PATypeInfo,char*> >::iterator
- I = $5->begin(), E = $5->end(); I != E; ++I, ++ArgIt) {
+ Function::arg_iterator ArgEnd = Fn->arg_end();
+ std::vector<std::pair<PATypeInfo,char*> >::iterator I = $5->begin();
+ std::vector<std::pair<PATypeInfo,char*> >::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);
#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"
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);
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...
// 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);
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<BasicBlock>(N);
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.
if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy)
error("LLVM functions cannot return aggregate types");
- std::vector<const Type*> ParamTypeList;
+ std::vector<const Type*> 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<std::pair<PATypeInfo,char*> >::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.
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;
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);
$5->pop_back(); // Delete the last entry
}
Function::arg_iterator ArgIt = Fn->arg_begin();
- for (std::vector<std::pair<PATypeInfo,char*> >::iterator
- I = $5->begin(), E = $5->end(); I != E; ++I, ++ArgIt) {
+ Function::arg_iterator ArgEnd = Fn->arg_end();
+ std::vector<std::pair<PATypeInfo,char*> >::iterator I = $5->begin();
+ std::vector<std::pair<PATypeInfo,char*> >::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);
#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"
#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"
// 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));
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)