blob: 1be2e865e8063905f1ecf86146b94c6feb1468e2 [file] [log] [blame]
Brian Gaeke03cac372004-04-25 07:04:49 +00001//===- lib/Target/SparcV9/MappingInfo.h -------------------------*- C++ -*-===//
John Criswell29265fe2003-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 Gaeke44b2d7a2003-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 Lattnerec611ae2003-08-13 02:38:16 +000015#ifndef MAPPINGINFO_H
16#define MAPPINGINFO_H
Mehwish Nagdaf6f772b2002-07-22 22:09:35 +000017
18#include <iosfwd>
Brian Gaeke44b2d7a2003-06-04 22:02:47 +000019#include <vector>
20#include <string>
Brian Gaeke960707c2003-11-11 22:41:34 +000021
22namespace llvm {
23
Chris Lattner4f2cf032004-09-20 04:48:05 +000024class ModulePass;
Mehwish Nagdaf6f772b2002-07-22 22:09:35 +000025
Chris Lattner4f2cf032004-09-20 04:48:05 +000026ModulePass *getMappingInfoAsmPrinterPass(std::ostream &out);
27ModulePass *createInternalGlobalMapperPass();
Brian Gaeke44b2d7a2003-06-04 22:02:47 +000028
29class MappingInfo {
Chris Lattnerec611ae2003-08-13 02:38:16 +000030 struct byteVector : public std::vector <unsigned char> {
31 void dumpAssembly (std::ostream &Out);
Brian Gaeke44b2d7a2003-06-04 22:02:47 +000032 };
33 std::string comment;
34 std::string symbolPrefix;
35 unsigned functionNumber;
36 byteVector bytes;
37public:
38 void outByte (unsigned char b) { bytes.push_back (b); }
Chris Lattnerec611ae2003-08-13 02:38:16 +000039 MappingInfo (std::string Comment, std::string SymbolPrefix,
40 unsigned FunctionNumber) : comment(Comment),
41 symbolPrefix(SymbolPrefix), functionNumber(FunctionNumber) {}
Brian Gaeke44b2d7a2003-06-04 22:02:47 +000042 void dumpAssembly (std::ostream &Out);
Chris Lattnerec611ae2003-08-13 02:38:16 +000043 unsigned char *getBytes (unsigned &length) {
Brian Gaeke44b2d7a2003-06-04 22:02:47 +000044 length = bytes.size(); return &bytes[0];
45 }
46};
Mehwish Nagdaf6f772b2002-07-22 22:09:35 +000047
Brian Gaeke960707c2003-11-11 22:41:34 +000048} // End llvm namespace
49
Mehwish Nagdaf6f772b2002-07-22 22:09:35 +000050#endif