pass the mangler down into the various SectionForGlobal methods.
[oota-llvm.git] / lib / Target / PIC16 / PIC16DebugInfo.h
index 582d821eb3041bd21854c5665b611962a05a2018..b1360fb4e323c86d749d92d7762c6910083af170 100644 (file)
 #ifndef PIC16DBG_H
 #define PIC16DBG_H
 
-#include "llvm/Analysis/DebugInfo.h" 
+#include "llvm/Analysis/DebugInfo.h"
+#include "llvm/Module.h"
+#include "llvm/Target/TargetAsmInfo.h" 
+#include <map>
 
 namespace llvm {
+  class MachineFunction;
+  class DebugLoc;
   namespace PIC16Dbg {
     enum VarType {
       T_NULL,
@@ -80,14 +85,76 @@ namespace llvm {
       C_SECTION,
       C_EFCN = 255
     };
+    enum SymbolSize {
+      AuxSize =20
+    };
   }
 
+  class formatted_raw_ostream;
+
   class PIC16DbgInfo {
+    formatted_raw_ostream &O;
+    const TargetAsmInfo *TAI;
+    std::string CurFile;
+    unsigned CurLine;
+
+    // EmitDebugDirectives is set if debug information is available. Default
+    // value for it is false.
+    bool EmitDebugDirectives;
+
   public:
-    void PopulateDebugInfo(DIType Ty, unsigned short &TypeNo, bool &HasAux,
+    PIC16DbgInfo(formatted_raw_ostream &o, const TargetAsmInfo *T)
+      : O(o), TAI(T) {
+      CurFile = "";
+      CurLine = 0;
+      EmitDebugDirectives = false; 
+    }
+
+    void BeginModule (Module &M);
+    void BeginFunction (const MachineFunction &MF);
+    void ChangeDebugLoc (const MachineFunction &MF, const DebugLoc &DL,
+                         bool IsInBeginFunction = false);
+    void EndFunction (const MachineFunction &MF);
+    void EndModule (Module &M);
+
+
+    private:
+    void SwitchToCU (GlobalVariable *CU);
+    void SwitchToLine (unsigned Line, bool IsInBeginFunction = false);
+
+    void PopulateDebugInfo (DIType Ty, unsigned short &TypeNo, bool &HasAux,
                            int Aux[], std::string &TypeName);
-    unsigned GetTypeDebugNumber(std::string &type);
-    short getClass(DIGlobalVariable DIGV);
+    void PopulateBasicTypeInfo (DIType Ty, unsigned short &TypeNo);
+    void PopulateDerivedTypeInfo (DIType Ty, unsigned short &TypeNo, 
+                                  bool &HasAux, int Aux[],
+                                  std::string &TypeName);
+
+    void PopulateCompositeTypeInfo (DIType Ty, unsigned short &TypeNo,
+                                    bool &HasAux, int Aux[],
+                                    std::string &TypeName);
+    void PopulateArrayTypeInfo (DIType Ty, unsigned short &TypeNo,
+                                bool &HasAux, int Aux[],
+                                std::string &TypeName);
+
+    void PopulateStructOrUnionTypeInfo (DIType Ty, unsigned short &TypeNo,
+                                        bool &HasAux, int Aux[],
+                                        std::string &TypeName);
+    void PopulateEnumTypeInfo (DIType Ty, unsigned short &TypeNo);
+
+    unsigned GetTypeDebugNumber(std::string &Type);
+    short getStorageClass(DIGlobalVariable DIGV);
+    void EmitFunctBeginDI(const Function *F);
+    void EmitCompositeTypeDecls(Module &M);
+    void EmitCompositeTypeElements (DICompositeType CTy,
+                                    std::string UniqueSuffix);
+    void EmitFunctEndDI(const Function *F, unsigned Line);
+    void EmitAuxEntry(const std::string VarName, int Aux[], 
+                      int num = PIC16Dbg::AuxSize, std::string TagName = "");
+    inline void EmitSymbol(std::string Name, short Class, 
+                           unsigned short Type = PIC16Dbg::T_NULL, 
+                           unsigned long Value = 0);
+    void EmitVarDebugInfo(Module &M);
+    void EmitEOF();
   };
 } // end namespace llvm;
 #endif