2007-01-05 17:18:58 +00:00
|
|
|
//===-- UpgradeInternals.h - Internal parser definitionsr -------*- C++ -*-===//
|
2006-11-30 06:36:44 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by Reid Spencer and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This header file defines the variables that are shared between the lexer,
|
|
|
|
// the parser, and the main program.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-01-05 17:18:58 +00:00
|
|
|
#ifndef UPGRADE_INTERNALS_H
|
|
|
|
#define UPGRADE_INTERNALS_H
|
2006-11-30 06:36:44 +00:00
|
|
|
|
2007-01-02 05:44:33 +00:00
|
|
|
#include <llvm/ADT/StringExtras.h>
|
2006-11-30 06:36:44 +00:00
|
|
|
#include <string>
|
2006-11-30 16:50:26 +00:00
|
|
|
#include <istream>
|
2006-12-02 15:16:01 +00:00
|
|
|
#include <vector>
|
2007-01-05 17:18:58 +00:00
|
|
|
#include <set>
|
2007-01-02 05:44:33 +00:00
|
|
|
#include <cassert>
|
2006-11-30 06:36:44 +00:00
|
|
|
|
2007-01-15 00:25:53 +00:00
|
|
|
// Global variables exported from the lexer.
|
2006-11-30 06:36:44 +00:00
|
|
|
extern std::string CurFileName;
|
|
|
|
extern std::string Textin;
|
|
|
|
extern int Upgradelineno;
|
2006-11-30 16:50:26 +00:00
|
|
|
extern std::istream* LexInput;
|
2006-11-30 06:36:44 +00:00
|
|
|
|
2007-01-15 00:25:53 +00:00
|
|
|
// Global variables exported from the parser.
|
2006-11-30 06:36:44 +00:00
|
|
|
extern char* Upgradetext;
|
|
|
|
extern int Upgradeleng;
|
2006-12-01 20:26:20 +00:00
|
|
|
extern unsigned SizeOfPointer;
|
2006-11-30 06:36:44 +00:00
|
|
|
|
2007-01-15 00:25:53 +00:00
|
|
|
// Functions exported by the parser
|
|
|
|
void UpgradeAssembly(
|
|
|
|
const std::string & infile, std::istream& in, std::ostream &out, bool debug,
|
|
|
|
bool addAttrs);
|
2006-11-30 06:36:44 +00:00
|
|
|
int yyerror(const char *ErrorMsg) ;
|
|
|
|
|
2006-12-01 20:26:20 +00:00
|
|
|
/// This enum is used to keep track of the original (1.9) type used to form
|
|
|
|
/// a type. These are needed for type upgrades and to determine how to upgrade
|
2007-01-15 00:25:53 +00:00
|
|
|
/// signed instructions with signless operands. The Lexer uses thse in its
|
|
|
|
/// calls to getTypeInfo
|
2006-12-01 20:26:20 +00:00
|
|
|
enum Types {
|
|
|
|
BoolTy, SByteTy, UByteTy, ShortTy, UShortTy, IntTy, UIntTy, LongTy, ULongTy,
|
2006-12-31 06:02:26 +00:00
|
|
|
FloatTy, DoubleTy, PointerTy, PackedTy, ArrayTy, StructTy, PackedStructTy,
|
2007-01-03 23:45:17 +00:00
|
|
|
OpaqueTy, VoidTy, LabelTy, FunctionTy, UnresolvedTy, UpRefTy
|
2006-12-01 20:26:20 +00:00
|
|
|
};
|
|
|
|
|
2007-01-15 00:25:53 +00:00
|
|
|
namespace {
|
|
|
|
class TypeInfo;
|
|
|
|
class ValueInfo;
|
|
|
|
class ConstInfo;
|
|
|
|
}
|
2007-01-06 06:03:09 +00:00
|
|
|
|
2007-01-15 00:25:53 +00:00
|
|
|
typedef std::vector<const TypeInfo*> TypeList;
|
|
|
|
typedef std::vector<ValueInfo*> ValueList;
|
2006-12-02 15:16:01 +00:00
|
|
|
|
2007-01-15 00:25:53 +00:00
|
|
|
/// A function to create a TypeInfo* used in the Lexer.
|
|
|
|
extern const TypeInfo* getTypeInfo(const std::string& newTy, Types oldTy);
|
2006-12-02 15:16:01 +00:00
|
|
|
|
2006-11-30 06:36:44 +00:00
|
|
|
#endif
|