dcc.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /****************************************************************************
  2. * dcc project general header
  3. * (C) Cristina Cifuentes, Mike van Emmerik
  4. ****************************************************************************/
  5. #pragma once
  6. //TODO: Remove boolT
  7. #include <utility>
  8. #include <algorithm>
  9. #include <bitset>
  10. #include <QtCore/QString>
  11. #include "Enums.h"
  12. #include "types.h"
  13. #include "ast.h"
  14. #include "icode.h"
  15. #include "locident.h"
  16. #include "error.h"
  17. #include "graph.h"
  18. #include "bundle.h"
  19. #include "Procedure.h"
  20. #include "BasicBlock.h"
  21. class Project;
  22. /* CALL GRAPH NODE */
  23. extern bundle cCode; /* Output C procedure's declaration and code */
  24. /**** Global variables ****/
  25. extern QString asm1_name, asm2_name; /* Assembler output filenames */
  26. /** Command line option flags */
  27. struct OPTION
  28. {
  29. bool verbose;
  30. bool VeryVerbose;
  31. bool asm1; /* Early disassembly listing */
  32. bool asm2; /* Disassembly listing after restruct */
  33. bool Map;
  34. bool Stats;
  35. bool Interact; /* Interactive mode */
  36. bool Calls; /* Follow register indirect calls */
  37. QString filename; /* The input filename */
  38. uint32_t CustomEntryPoint;
  39. };
  40. extern OPTION option; /* Command line options */
  41. #include "BinaryImage.h"
  42. /* Memory map states */
  43. enum eAreaType
  44. {
  45. BM_UNKNOWN = 0, /* Unscanned memory */
  46. BM_DATA = 1, /* Data */
  47. BM_CODE = 2, /* Code */
  48. BM_IMPURE = 3 /* Used as Data and Code*/
  49. };
  50. /* Intermediate instructions statistics */
  51. struct STATS
  52. {
  53. int numBBbef; /* number of basic blocks initially */
  54. int numBBaft; /* number of basic blocks at the end */
  55. int nOrder; /* n-th order */
  56. int numLLIcode; /* number of low-level Icode instructions */
  57. int numHLIcode; /* number of high-level Icode instructions */
  58. int totalLL; /* total number of low-level Icode insts */
  59. int totalHL; /* total number of high-level Icod insts */
  60. };
  61. extern STATS stats; /* Icode statistics */
  62. /**** Global function prototypes ****/
  63. void udm(void); /* udm.c */
  64. void freeCFG(BB * cfg); /* graph.c */
  65. BB * newBB(BB *, int, int, uint8_t, int, Function *); /* graph.c */
  66. void BackEnd(CALL_GRAPH *); /* backend.c */
  67. extern char *cChar(uint8_t c); /* backend.c */
  68. eErrorId scan(uint32_t ip, ICODE &p); /* scanner.c */
  69. void parse (CALL_GRAPH * *); /* parser.c */
  70. extern int strSize (const uint8_t *, char); /* parser.c */
  71. //void disassem(int pass, Function * pProc); /* disassem.c */
  72. void interactDis(Function *, int initIC); /* disassem.c */
  73. bool JmpInst(llIcode opcode); /* idioms.c */
  74. queue::iterator appendQueue(queue &Q, BB *node); /* reducible.c */
  75. bool SetupLibCheck(void); /* chklib.c */
  76. void CleanupLibCheck(void); /* chklib.c */
  77. bool LibCheck(Function &p); /* chklib.c */
  78. /* Exported functions from hlicode.c */
  79. QString writeJcond(const HLTYPE &, Function *, int *);
  80. QString writeJcondInv(HLTYPE, Function *, int *);
  81. /* Exported funcions from locident.c */
  82. bool checkLongEq(LONG_STKID_TYPE, iICODE, int, Function *, Assignment &asgn, LLInst &atOffset);
  83. bool checkLongRegEq(LONGID_TYPE, iICODE, int, Function *, Assignment &asgn, LLInst &);
  84. extern const char *indentStr(int level);