blob: f86e2b42b7a6e0325a55419d5176ddee72ff030d [file] [log] [blame]
Chris Lattner48e60792003-08-13 02:38:16 +00001//===- lib/Target/Sparc/MappingInfo.h ---------------------------*- C++ -*-===//
John Criswell856ba762003-10-21 15:17:13 +00002//
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//===----------------------------------------------------------------------===//
Brian Gaekec86b8d52003-06-04 22:02:47 +00009//
10// Data structures to support the Reoptimizer's Instruction-to-MachineInstr
11// mapping information gatherer.
12//
13//===----------------------------------------------------------------------===//
14
Chris Lattner48e60792003-08-13 02:38:16 +000015#ifndef MAPPINGINFO_H
16#define MAPPINGINFO_H
Mehwish Nagda5fb72ae2002-07-22 22:09:35 +000017
18#include <iosfwd>
Brian Gaekec86b8d52003-06-04 22:02:47 +000019#include <vector>
20#include <string>
Mehwish Nagda5fb72ae2002-07-22 22:09:35 +000021class Pass;
22
Brian Gaekeb92c5c02003-09-18 17:37:35 +000023Pass *getMappingInfoAsmPrinterPass(std::ostream &out);
Brian Gaekec86b8d52003-06-04 22:02:47 +000024
25class MappingInfo {
Chris Lattner48e60792003-08-13 02:38:16 +000026 struct byteVector : public std::vector <unsigned char> {
27 void dumpAssembly (std::ostream &Out);
Brian Gaekec86b8d52003-06-04 22:02:47 +000028 };
29 std::string comment;
30 std::string symbolPrefix;
31 unsigned functionNumber;
32 byteVector bytes;
33public:
34 void outByte (unsigned char b) { bytes.push_back (b); }
Chris Lattner48e60792003-08-13 02:38:16 +000035 MappingInfo (std::string Comment, std::string SymbolPrefix,
36 unsigned FunctionNumber) : comment(Comment),
37 symbolPrefix(SymbolPrefix), functionNumber(FunctionNumber) {}
Brian Gaekec86b8d52003-06-04 22:02:47 +000038 void dumpAssembly (std::ostream &Out);
Chris Lattner48e60792003-08-13 02:38:16 +000039 unsigned char *getBytes (unsigned &length) {
Brian Gaekec86b8d52003-06-04 22:02:47 +000040 length = bytes.size(); return &bytes[0];
41 }
42};
Mehwish Nagda5fb72ae2002-07-22 22:09:35 +000043
44#endif