blob: f01d415f6b5b080d08f1f2fd004a931353ee9928 [file] [log] [blame]
Reid Spencer90eb4d62007-01-05 17:18:58 +00001//===-- 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 Spencere0a15bb2007-01-15 00:25:53 +000025// Global variables exported from the lexer.
Reid Spencer90eb4d62007-01-05 17:18:58 +000026extern std::string CurFileName;
27extern std::string Textin;
28extern int Upgradelineno;
29extern std::istream* LexInput;
30
Reid Spencere0a15bb2007-01-15 00:25:53 +000031// Global variables exported from the parser.
Reid Spencer90eb4d62007-01-05 17:18:58 +000032extern char* Upgradetext;
33extern int Upgradeleng;
34extern unsigned SizeOfPointer;
35
Reid Spencere0a15bb2007-01-15 00:25:53 +000036// Functions exported by the parser
37void UpgradeAssembly(
38 const std::string & infile, std::istream& in, std::ostream &out, bool debug,
39 bool addAttrs);
Reid Spencer90eb4d62007-01-05 17:18:58 +000040int 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 Spencere0a15bb2007-01-15 00:25:53 +000044/// signed instructions with signless operands. The Lexer uses thse in its
Reid Spencer3d6cd1b2007-01-15 02:40:33 +000045/// calls to getType
46enum TypeIDs {
Reid Spencer90eb4d62007-01-05 17:18:58 +000047 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 Spencere0a15bb2007-01-15 00:25:53 +000052namespace {
Reid Spencer3d6cd1b2007-01-15 02:40:33 +000053class Type;
54class Value;
55class Constant;
56class Instruction;
Reid Spencere0a15bb2007-01-15 00:25:53 +000057}
Reid Spencer90eb4d62007-01-05 17:18:58 +000058
Reid Spencer3d6cd1b2007-01-15 02:40:33 +000059typedef std::vector<const Type*> TypeList;
60typedef std::vector<Value*> ValueList;
Reid Spencer90eb4d62007-01-05 17:18:58 +000061
Reid Spencer3d6cd1b2007-01-15 02:40:33 +000062/// A function to create a Typeo* used in the Lexer.
63extern const Type* getType(const std::string& newTy, TypeIDs oldTy);
Reid Spencer90eb4d62007-01-05 17:18:58 +000064
65#endif