Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame] | 1 | //===- lib/Target/Sparc/MappingInfo.h ---------------------------*- C++ -*-===// |
Brian Gaeke | c86b8d5 | 2003-06-04 22:02:47 +0000 | [diff] [blame] | 2 | // |
| 3 | // Data structures to support the Reoptimizer's Instruction-to-MachineInstr |
| 4 | // mapping information gatherer. |
| 5 | // |
| 6 | //===----------------------------------------------------------------------===// |
| 7 | |
Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame] | 8 | #ifndef MAPPINGINFO_H |
| 9 | #define MAPPINGINFO_H |
Mehwish Nagda | 5fb72ae | 2002-07-22 22:09:35 +0000 | [diff] [blame] | 10 | |
| 11 | #include <iosfwd> |
Brian Gaeke | c86b8d5 | 2003-06-04 22:02:47 +0000 | [diff] [blame] | 12 | #include <vector> |
| 13 | #include <string> |
Mehwish Nagda | 5fb72ae | 2002-07-22 22:09:35 +0000 | [diff] [blame] | 14 | class Pass; |
| 15 | |
Brian Gaeke | b92c5c0 | 2003-09-18 17:37:35 +0000 | [diff] [blame^] | 16 | Pass *getMappingInfoAsmPrinterPass(std::ostream &out); |
Brian Gaeke | c86b8d5 | 2003-06-04 22:02:47 +0000 | [diff] [blame] | 17 | |
| 18 | class MappingInfo { |
Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame] | 19 | struct byteVector : public std::vector <unsigned char> { |
| 20 | void dumpAssembly (std::ostream &Out); |
Brian Gaeke | c86b8d5 | 2003-06-04 22:02:47 +0000 | [diff] [blame] | 21 | }; |
| 22 | std::string comment; |
| 23 | std::string symbolPrefix; |
| 24 | unsigned functionNumber; |
| 25 | byteVector bytes; |
| 26 | public: |
| 27 | void outByte (unsigned char b) { bytes.push_back (b); } |
Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame] | 28 | MappingInfo (std::string Comment, std::string SymbolPrefix, |
| 29 | unsigned FunctionNumber) : comment(Comment), |
| 30 | symbolPrefix(SymbolPrefix), functionNumber(FunctionNumber) {} |
Brian Gaeke | c86b8d5 | 2003-06-04 22:02:47 +0000 | [diff] [blame] | 31 | void dumpAssembly (std::ostream &Out); |
Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame] | 32 | unsigned char *getBytes (unsigned &length) { |
Brian Gaeke | c86b8d5 | 2003-06-04 22:02:47 +0000 | [diff] [blame] | 33 | length = bytes.size(); return &bytes[0]; |
| 34 | } |
| 35 | }; |
Mehwish Nagda | 5fb72ae | 2002-07-22 22:09:35 +0000 | [diff] [blame] | 36 | |
| 37 | #endif |