blob: d9a2e843d808ef77ab771ae0336fefbf3991c325 [file] [log] [blame]
Reid Spencerdac69c82004-06-07 17:53:43 +00001//===-- ReaderInternals.h - Definitions internal to the reader --*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group 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 various stuff that is used by the bytecode reader.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef ANALYZER_INTERNALS_H
15#define ANALYZER_INTERNALS_H
16
17#include "Parser.h"
18#include "llvm/Bytecode/Analyzer.h"
19
20// Enable to trace to figure out what the heck is going on when parsing fails
21//#define TRACE_LEVEL 10
22//#define DEBUG_OUTPUT
23
24#if TRACE_LEVEL // ByteCodeReading_TRACEr
25#define BCR_TRACE(n, X) \
26 if (n < TRACE_LEVEL) std::cerr << std::string(n*2, ' ') << X
27#else
28#define BCR_TRACE(n, X)
29#endif
30
31namespace llvm {
32
33class BytecodeAnalyzer {
34 BytecodeAnalyzer(const BytecodeAnalyzer &); // DO NOT IMPLEMENT
35 void operator=(const BytecodeAnalyzer &); // DO NOT IMPLEMENT
36public:
37 BytecodeAnalyzer() { }
38 ~BytecodeAnalyzer() { }
39
40 void AnalyzeBytecode(
41 const unsigned char *Buf,
42 unsigned Length,
43 BytecodeAnalysis& bca,
44 const std::string &ModuleID
45 );
46
47 void DumpBytecode(
48 const unsigned char *Buf,
49 unsigned Length,
50 BytecodeAnalysis& bca,
51 const std::string &ModuleID
52 );
53
54 void dump() const {
55 std::cerr << "BytecodeParser instance!\n";
56 }
57private:
58 BytecodeAnalysis TheAnalysis;
59};
60
61} // End llvm namespace
62
63#endif
64
65// vim: sw=2