BackEnd.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. #include <wchar.h>
  7. // =================
  8. // Runtime Includes
  9. // =================
  10. #include "Runtime.h"
  11. #include "ByteCode\StatementReader.h"
  12. #include "Language\EHBailoutData.h"
  13. #include "Language\AsmJsTypes.h"
  14. #include "Language\AsmJsModule.h"
  15. #include "Language\ProfilingHelpers.h"
  16. #include "Language\FunctionCodeGenRuntimeData.h"
  17. #include "Language\FunctionCodeGenJitTimeData.h"
  18. #include "Language\JavascriptMathOperators.h"
  19. #include "Language\JavascriptMathOperators.inl"
  20. #include "Language\JavascriptStackWalker.h"
  21. #include "Language\CodeGenRecyclableData.h"
  22. #include "Library\JavascriptGenerator.h"
  23. #include "Library\JavascriptRegularExpression.h"
  24. #include "Library\StackScriptFunction.h"
  25. #include "Language\InterpreterStackFrame.h"
  26. #include "Language\ReadOnlyDynamicProfileInfo.h"
  27. // SIMD types
  28. #include "Library\JavascriptSIMDFloat32x4.h"
  29. #include "Library\JavascriptSIMDFloat64x2.h"
  30. #include "Library\JavascriptSIMDInt32x4.h"
  31. #include "Library\JavascriptSIMDInt8x16.h"
  32. // SIMD operations
  33. #include "Language\SIMDFloat32x4Operation.h"
  34. #include "Language\SIMDFloat64x2Operation.h"
  35. #include "Language\SIMDInt32x4Operation.h"
  36. #include "Language\SIMDInt8x16Operation.h"
  37. // SIMD libs
  38. #include "Library\SIMDFloat32x4Lib.h"
  39. #include "Library\SIMDFloat64x2Lib.h"
  40. #include "Library\SIMDInt32x4Lib.h"
  41. #include "Library\SIMDInt8x16Lib.h"
  42. // =================
  43. // Common Includes
  44. // =================
  45. #include "DataStructures\Pair.h"
  46. #include "DataStructures\HashTable.h"
  47. // =================
  48. //
  49. // Defines
  50. //
  51. // The shld optimization is bad for AMD hardware
  52. // The lack of it is ameliorated for Intel hardware by adding BTS optimization
  53. #undef SHIFTLOAD
  54. #define Fatal() Js::Throw::FatalInternalError()
  55. // By default, do encode large user constants for security.
  56. #ifndef MD_ENCODE_LG_CONSTS
  57. #define MD_ENCODE_LG_CONSTS true
  58. #endif
  59. //
  60. // Forward refs
  61. //
  62. class Func;
  63. class Loop;
  64. //
  65. // Typedefs
  66. //
  67. const int32 IntConstMax = INT_MAX;
  68. const int32 IntConstMin = INT_MIN;
  69. const int32 Int8ConstMax = _I8_MAX;
  70. const int32 Int8ConstMin = _I8_MIN;
  71. const int32 Int16ConstMax = _I16_MAX;
  72. const int32 Int16ConstMin = _I16_MIN;
  73. const int32 Int32ConstMax = _I32_MAX;
  74. const int32 Int32ConstMin = _I32_MIN;
  75. const int32 Uint8ConstMax = _UI8_MAX;
  76. const int32 Uint8ConstMin = 0;
  77. const int32 Uint16ConstMax = _UI16_MAX;
  78. const int32 Uint16ConstMin = 0;
  79. #if defined(_M_X64) || defined(_M_ARM32_OR_ARM64)
  80. // Arm VFPv3-D32 has 32 double registers and 16 int registers total 48.
  81. // Arm64 has 32 vector registers and 32 int registers total 64.
  82. // Amd64 has 16 int and 16 xmm registers and slot for NOREG makes it 33 hence 64 bit version
  83. // for Amd64 & Arm
  84. typedef BVUnit64 BitVector;
  85. #else
  86. // x86 has only 8 int registers & 8 xmm registers
  87. // 32 bit vector is sufficient to address all the registers
  88. typedef BVUnit32 BitVector;
  89. #endif
  90. #if DBG_DUMP || defined(ENABLE_IR_VIEWER)
  91. enum IRDumpFlags
  92. {
  93. IRDumpFlags_None = 0x0,
  94. IRDumpFlags_AsmDumpMode = 0x1,
  95. IRDumpFlags_SimpleForm = 0x2,
  96. IRDumpFlags_SkipEndLine = 0x4,
  97. IRDumpFlags_SkipByteCodeOffset = 0x8,
  98. };
  99. #endif
  100. //
  101. // BackEnd includes
  102. //
  103. #include "NativeCodeData.h"
  104. #include "CodeGenAllocators.h"
  105. #include "IRType.h"
  106. #include "md.h"
  107. #include "..\Runtime\ByteCode\BackEndOpcodeAttr.h"
  108. #include "BackEndOpCodeAttrAsmJs.h"
  109. #include "JnHelperMethod.h"
  110. #include "Reg.h"
  111. #include "Sym.h"
  112. #include "SymTable.h"
  113. #include "IR.h"
  114. #include "Opnd.h"
  115. #include "IntOverflowDoesNotMatterRange.h"
  116. #include "IntConstantBounds.h"
  117. #include "ValueRelativeOffset.h"
  118. #include "IntBounds.h"
  119. #include "InductionVariable.h"
  120. #include "GlobOpt.h"
  121. #include "GlobOptIntBounds.h"
  122. #include "CodeGenWorkItemType.h"
  123. #include "QueuedFullJitWorkItem.h"
  124. #include "CodeGenWorkItem.h"
  125. #include "SimpleJitProfilingHelpers.h"
  126. #if defined(_M_X64)
  127. #include "PrologEncoder.h"
  128. #endif
  129. #include "Func.h"
  130. #include "TempTracker.h"
  131. #include "FlowGraph.h"
  132. #include "PDataManager.h"
  133. #include "CaseNode.h"
  134. #include "SwitchIRBuilder.h"
  135. #include "IRBuilder.h"
  136. #include "IRBuilderAsmJs.h"
  137. #include "BackwardPass.h"
  138. #include "Lower.h"
  139. #include "Security.h"
  140. #include "Peeps.h"
  141. #include "LinearScan.h"
  142. #include "SimpleLayout.h"
  143. #include "Encoder.h"
  144. #include "EmitBuffer.h"
  145. #include "InterpreterThunkEmitter.h"
  146. #include "InliningHeuristics.h"
  147. #include "InliningDecider.h"
  148. #include "Inline.h"
  149. #include "NativeCodeGenerator.h"
  150. #include "Region.h"
  151. #include "BailOut.h"
  152. #include "InlineeFrameInfo.h"
  153. #include "IRViewer.h"
  154. #if DBG
  155. # include "DbCheckPostLower.h"
  156. #endif
  157. //
  158. // Inlines
  159. //
  160. #include "Sym.inl"
  161. #include "IR.inl"
  162. #include "Opnd.inl"