Sanjiv Gupta | a57bc3b | 2009-05-22 13:58:45 +0000 | [diff] [blame] | 1 | //===-- PIC16DebugInfo.h - Interfaces for PIC16 Debug Information ============// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the helper functions for representing debug information. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef PIC16DBG_H |
| 15 | #define PIC16DBG_H |
| 16 | |
Sanjiv Gupta | dd4694b | 2009-05-28 18:24:11 +0000 | [diff] [blame^] | 17 | #include "llvm/Analysis/DebugInfo.h" |
| 18 | #include "llvm/Module.h" |
| 19 | #include "llvm/Target/TargetAsmInfo.h" |
| 20 | #include <map> |
Sanjiv Gupta | a57bc3b | 2009-05-22 13:58:45 +0000 | [diff] [blame] | 21 | |
| 22 | namespace llvm { |
| 23 | namespace PIC16Dbg { |
| 24 | enum VarType { |
| 25 | T_NULL, |
| 26 | T_VOID, |
| 27 | T_CHAR, |
| 28 | T_SHORT, |
| 29 | T_INT, |
| 30 | T_LONG, |
| 31 | T_FLOAT, |
| 32 | T_DOUBLE, |
| 33 | T_STRUCT, |
| 34 | T_UNION, |
| 35 | T_ENUM, |
| 36 | T_MOE, |
| 37 | T_UCHAR, |
| 38 | T_USHORT, |
| 39 | T_UINT, |
| 40 | T_ULONG |
| 41 | }; |
| 42 | enum DerivedType { |
| 43 | DT_NONE, |
| 44 | DT_PTR, |
| 45 | DT_FCN, |
| 46 | DT_ARY |
| 47 | }; |
| 48 | enum TypeSize { |
| 49 | S_BASIC = 5, |
| 50 | S_DERIVED = 3 |
| 51 | }; |
| 52 | enum DbgClass { |
| 53 | C_NULL, |
| 54 | C_AUTO, |
| 55 | C_EXT, |
| 56 | C_STAT, |
| 57 | C_REG, |
| 58 | C_EXTDEF, |
| 59 | C_LABEL, |
| 60 | C_ULABEL, |
| 61 | C_MOS, |
| 62 | C_ARG, |
| 63 | C_STRTAG, |
| 64 | C_MOU, |
| 65 | C_UNTAG, |
| 66 | C_TPDEF, |
| 67 | C_USTATIC, |
| 68 | C_ENTAG, |
| 69 | C_MOE, |
| 70 | C_REGPARM, |
| 71 | C_FIELD, |
| 72 | C_AUTOARG, |
| 73 | C_LASTENT, |
| 74 | C_BLOCK = 100, |
| 75 | C_FCN, |
| 76 | C_EOS, |
| 77 | C_FILE, |
| 78 | C_LINE, |
| 79 | C_ALIAS, |
| 80 | C_HIDDEN, |
| 81 | C_EOF, |
| 82 | C_LIST, |
| 83 | C_SECTION, |
| 84 | C_EFCN = 255 |
| 85 | }; |
Sanjiv Gupta | dd4694b | 2009-05-28 18:24:11 +0000 | [diff] [blame^] | 86 | enum SymbolSize { |
| 87 | AuxSize =20 |
| 88 | }; |
Sanjiv Gupta | a57bc3b | 2009-05-22 13:58:45 +0000 | [diff] [blame] | 89 | } |
| 90 | |
Sanjiv Gupta | dd4694b | 2009-05-28 18:24:11 +0000 | [diff] [blame^] | 91 | class raw_ostream; |
| 92 | |
Sanjiv Gupta | a57bc3b | 2009-05-22 13:58:45 +0000 | [diff] [blame] | 93 | class PIC16DbgInfo { |
Sanjiv Gupta | dd4694b | 2009-05-28 18:24:11 +0000 | [diff] [blame^] | 94 | std::map <std::string, DISubprogram *> FunctNameMap; |
| 95 | raw_ostream &O; |
| 96 | const TargetAsmInfo *TAI; |
Sanjiv Gupta | a57bc3b | 2009-05-22 13:58:45 +0000 | [diff] [blame] | 97 | public: |
Sanjiv Gupta | dd4694b | 2009-05-28 18:24:11 +0000 | [diff] [blame^] | 98 | PIC16DbgInfo(raw_ostream &o, const TargetAsmInfo *T) : O(o), TAI(T) {} |
| 99 | ~PIC16DbgInfo(); |
Sanjiv Gupta | a57bc3b | 2009-05-22 13:58:45 +0000 | [diff] [blame] | 100 | void PopulateDebugInfo(DIType Ty, unsigned short &TypeNo, bool &HasAux, |
| 101 | int Aux[], std::string &TypeName); |
| 102 | unsigned GetTypeDebugNumber(std::string &type); |
| 103 | short getClass(DIGlobalVariable DIGV); |
Sanjiv Gupta | dd4694b | 2009-05-28 18:24:11 +0000 | [diff] [blame^] | 104 | void PopulateFunctsDI(Module &M); |
| 105 | DISubprogram *getFunctDI(std::string FunctName); |
| 106 | void EmitFunctBeginDI(const Function *F); |
| 107 | void EmitFunctEndDI(const Function *F, unsigned Line); |
| 108 | void EmitAuxEntry(const std::string VarName, int Aux[], int num); |
| 109 | inline void EmitSymbol(std::string Name, int Class); |
| 110 | void EmitVarDebugInfo(Module &M); |
| 111 | void EmitFileDirective(Module &M); |
Sanjiv Gupta | a57bc3b | 2009-05-22 13:58:45 +0000 | [diff] [blame] | 112 | }; |
| 113 | } // end namespace llvm; |
| 114 | #endif |