aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-upgrade/UpgradeInternals.h
blob: f01d415f6b5b080d08f1f2fd004a931353ee9928 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//===-- UpgradeInternals.h - Internal parser definitionsr -------*- C++ -*-===//
//
//                     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.
//
//===----------------------------------------------------------------------===//

#ifndef UPGRADE_INTERNALS_H
#define UPGRADE_INTERNALS_H

#include <llvm/ADT/StringExtras.h>
#include <string>
#include <istream>
#include <vector>
#include <set>
#include <cassert>

// Global variables exported from the lexer.
extern std::string CurFileName;
extern std::string Textin;
extern int Upgradelineno;
extern std::istream* LexInput;

// Global variables exported from the parser.
extern char* Upgradetext;
extern int   Upgradeleng;
extern unsigned SizeOfPointer;

// Functions exported by the parser
void UpgradeAssembly(
  const std::string & infile, std::istream& in, std::ostream &out, bool debug,
  bool addAttrs);
int yyerror(const char *ErrorMsg) ;

/// 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
/// signed instructions with signless operands. The Lexer uses thse in its
/// calls to getType
enum TypeIDs {
  BoolTy, SByteTy, UByteTy, ShortTy, UShortTy, IntTy, UIntTy, LongTy, ULongTy,
  FloatTy, DoubleTy, PointerTy, PackedTy, ArrayTy, StructTy, PackedStructTy, 
  OpaqueTy, VoidTy, LabelTy, FunctionTy, UnresolvedTy, UpRefTy
};

namespace {
class Type;
class Value;
class Constant;
class Instruction;
}

typedef std::vector<const Type*> TypeList;
typedef std::vector<Value*> ValueList;

/// A function to create a Typeo* used in the Lexer.
extern const Type* getType(const std::string& newTy, TypeIDs oldTy);

#endif