blob: 6af116a6da28bc97d0770522d0cff39364674ace [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>
Brian Gaeked0fde302003-11-11 22:41:34 +000021
22namespace llvm {
23
Mehwish Nagda5fb72ae2002-07-22 22:09:35 +000024class Pass;
25
Brian Gaekeb92c5c02003-09-18 17:37:35 +000026Pass *getMappingInfoAsmPrinterPass(std::ostream &out);
Brian Gaekec86b8d52003-06-04 22:02:47 +000027
28class MappingInfo {
Chris Lattner48e60792003-08-13 02:38:16 +000029 struct byteVector : public std::vector <unsigned char> {
30 void dumpAssembly (std::ostream &Out);
Brian Gaekec86b8d52003-06-04 22:02:47 +000031 };
32 std::string comment;
33 std::string symbolPrefix;
34 unsigned functionNumber;
35 byteVector bytes;
36public:
37 void outByte (unsigned char b) { bytes.push_back (b); }
Chris Lattner48e60792003-08-13 02:38:16 +000038 MappingInfo (std::string Comment, std::string SymbolPrefix,
39 unsigned FunctionNumber) : comment(Comment),
40 symbolPrefix(SymbolPrefix), functionNumber(FunctionNumber) {}
Brian Gaekec86b8d52003-06-04 22:02:47 +000041 void dumpAssembly (std::ostream &Out);
Chris Lattner48e60792003-08-13 02:38:16 +000042 unsigned char *getBytes (unsigned &length) {
Brian Gaekec86b8d52003-06-04 22:02:47 +000043 length = bytes.size(); return &bytes[0];
44 }
45};
Mehwish Nagda5fb72ae2002-07-22 22:09:35 +000046
Brian Gaeked0fde302003-11-11 22:41:34 +000047} // End llvm namespace
48
Mehwish Nagda5fb72ae2002-07-22 22:09:35 +000049#endif