Reid Spencer | 90eb4d6 | 2007-01-05 17:18:58 +0000 | [diff] [blame] | 1 | //===-- UpgradeInternals.h - Internal parser definitionsr -------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by Reid Spencer and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This header file defines the variables that are shared between the lexer, |
| 11 | // the parser, and the main program. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef UPGRADE_INTERNALS_H |
| 16 | #define UPGRADE_INTERNALS_H |
| 17 | |
| 18 | #include <llvm/ADT/StringExtras.h> |
| 19 | #include <string> |
| 20 | #include <istream> |
| 21 | #include <vector> |
| 22 | #include <set> |
| 23 | #include <cassert> |
| 24 | |
Reid Spencer | e0a15bb | 2007-01-15 00:25:53 +0000 | [diff] [blame^] | 25 | // Global variables exported from the lexer. |
Reid Spencer | 90eb4d6 | 2007-01-05 17:18:58 +0000 | [diff] [blame] | 26 | extern std::string CurFileName; |
| 27 | extern std::string Textin; |
| 28 | extern int Upgradelineno; |
| 29 | extern std::istream* LexInput; |
| 30 | |
Reid Spencer | e0a15bb | 2007-01-15 00:25:53 +0000 | [diff] [blame^] | 31 | // Global variables exported from the parser. |
Reid Spencer | 90eb4d6 | 2007-01-05 17:18:58 +0000 | [diff] [blame] | 32 | extern char* Upgradetext; |
| 33 | extern int Upgradeleng; |
| 34 | extern unsigned SizeOfPointer; |
| 35 | |
Reid Spencer | e0a15bb | 2007-01-15 00:25:53 +0000 | [diff] [blame^] | 36 | // Functions exported by the parser |
| 37 | void UpgradeAssembly( |
| 38 | const std::string & infile, std::istream& in, std::ostream &out, bool debug, |
| 39 | bool addAttrs); |
Reid Spencer | 90eb4d6 | 2007-01-05 17:18:58 +0000 | [diff] [blame] | 40 | int yyerror(const char *ErrorMsg) ; |
| 41 | |
| 42 | /// This enum is used to keep track of the original (1.9) type used to form |
| 43 | /// a type. These are needed for type upgrades and to determine how to upgrade |
Reid Spencer | e0a15bb | 2007-01-15 00:25:53 +0000 | [diff] [blame^] | 44 | /// signed instructions with signless operands. The Lexer uses thse in its |
| 45 | /// calls to getTypeInfo |
Reid Spencer | 90eb4d6 | 2007-01-05 17:18:58 +0000 | [diff] [blame] | 46 | enum Types { |
| 47 | BoolTy, SByteTy, UByteTy, ShortTy, UShortTy, IntTy, UIntTy, LongTy, ULongTy, |
| 48 | FloatTy, DoubleTy, PointerTy, PackedTy, ArrayTy, StructTy, PackedStructTy, |
| 49 | OpaqueTy, VoidTy, LabelTy, FunctionTy, UnresolvedTy, UpRefTy |
| 50 | }; |
| 51 | |
Reid Spencer | e0a15bb | 2007-01-15 00:25:53 +0000 | [diff] [blame^] | 52 | namespace { |
| 53 | class TypeInfo; |
| 54 | class ValueInfo; |
| 55 | class ConstInfo; |
| 56 | } |
Reid Spencer | 90eb4d6 | 2007-01-05 17:18:58 +0000 | [diff] [blame] | 57 | |
Reid Spencer | e0a15bb | 2007-01-15 00:25:53 +0000 | [diff] [blame^] | 58 | typedef std::vector<const TypeInfo*> TypeList; |
| 59 | typedef std::vector<ValueInfo*> ValueList; |
Reid Spencer | 90eb4d6 | 2007-01-05 17:18:58 +0000 | [diff] [blame] | 60 | |
Reid Spencer | e0a15bb | 2007-01-15 00:25:53 +0000 | [diff] [blame^] | 61 | /// A function to create a TypeInfo* used in the Lexer. |
| 62 | extern const TypeInfo* getTypeInfo(const std::string& newTy, Types oldTy); |
Reid Spencer | 90eb4d6 | 2007-01-05 17:18:58 +0000 | [diff] [blame] | 63 | |
| 64 | #endif |