blob: e1bbcc0fa1647c712b49437b57e94446bed83bc3 [file] [log] [blame]
Chris Lattner48e60792003-08-13 02:38:16 +00001//===- lib/Target/Sparc/MappingInfo.h ---------------------------*- C++ -*-===//
Brian Gaekec86b8d52003-06-04 22:02:47 +00002//
3// Data structures to support the Reoptimizer's Instruction-to-MachineInstr
4// mapping information gatherer.
5//
6//===----------------------------------------------------------------------===//
7
Chris Lattner48e60792003-08-13 02:38:16 +00008#ifndef MAPPINGINFO_H
9#define MAPPINGINFO_H
Mehwish Nagda5fb72ae2002-07-22 22:09:35 +000010
11#include <iosfwd>
Brian Gaekec86b8d52003-06-04 22:02:47 +000012#include <vector>
13#include <string>
Mehwish Nagda5fb72ae2002-07-22 22:09:35 +000014class Pass;
15
Brian Gaekeb92c5c02003-09-18 17:37:35 +000016Pass *getMappingInfoAsmPrinterPass(std::ostream &out);
Brian Gaekec86b8d52003-06-04 22:02:47 +000017
18class MappingInfo {
Chris Lattner48e60792003-08-13 02:38:16 +000019 struct byteVector : public std::vector <unsigned char> {
20 void dumpAssembly (std::ostream &Out);
Brian Gaekec86b8d52003-06-04 22:02:47 +000021 };
22 std::string comment;
23 std::string symbolPrefix;
24 unsigned functionNumber;
25 byteVector bytes;
26public:
27 void outByte (unsigned char b) { bytes.push_back (b); }
Chris Lattner48e60792003-08-13 02:38:16 +000028 MappingInfo (std::string Comment, std::string SymbolPrefix,
29 unsigned FunctionNumber) : comment(Comment),
30 symbolPrefix(SymbolPrefix), functionNumber(FunctionNumber) {}
Brian Gaekec86b8d52003-06-04 22:02:47 +000031 void dumpAssembly (std::ostream &Out);
Chris Lattner48e60792003-08-13 02:38:16 +000032 unsigned char *getBytes (unsigned &length) {
Brian Gaekec86b8d52003-06-04 22:02:47 +000033 length = bytes.size(); return &bytes[0];
34 }
35};
Mehwish Nagda5fb72ae2002-07-22 22:09:35 +000036
37#endif