Fix reading Time zone rules using Julian days (#17672)
[platform/upstream/coreclr.git] / src / jit / emitpub.h
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4
5 /************************************************************************/
6 /*       Overall emitter control (including startup and shutdown)       */
7 /************************************************************************/
8
9 static void emitInit();
10 static void emitDone();
11
12 void emitBegCG(Compiler* comp, COMP_HANDLE cmpHandle);
13 void emitEndCG();
14
15 void emitBegFN(bool hasFramePtr
16 #if defined(DEBUG)
17                ,
18                bool checkAlign
19 #endif
20 #ifdef LEGACY_BACKEND
21                ,
22                unsigned lclSize
23 #endif // LEGACY_BACKEND
24                ,
25                unsigned maxTmpSize);
26
27 void emitEndFN();
28
29 void emitComputeCodeSizes();
30
31 unsigned emitEndCodeGen(Compiler* comp,
32                         bool      contTrkPtrLcls,
33                         bool      fullyInt,
34                         bool      fullPtrMap,
35                         bool      returnsGCr,
36                         unsigned  xcptnsCount,
37                         unsigned* prologSize,
38                         unsigned* epilogSize,
39                         void**    codeAddr,
40                         void**    coldCodeAddr,
41                         void**    consAddr);
42
43 /************************************************************************/
44 /*                      Method prolog and epilog                        */
45 /************************************************************************/
46
47 unsigned emitGetEpilogCnt();
48
49 template <typename Callback>
50 bool emitGenNoGCLst(Callback& cb);
51
52 void     emitBegProlog();
53 unsigned emitGetPrologOffsetEstimate();
54 void     emitMarkPrologEnd();
55 void     emitEndProlog();
56
57 void emitCreatePlaceholderIG(insGroupPlaceholderType igType,
58                              BasicBlock*             igBB,
59                              VARSET_VALARG_TP        GCvars,
60                              regMaskTP               gcrefRegs,
61                              regMaskTP               byrefRegs,
62                              bool                    last);
63
64 void emitGeneratePrologEpilog();
65 void emitStartPrologEpilogGeneration();
66 void emitFinishPrologEpilogGeneration();
67
68 /************************************************************************/
69 /*           Record a code position and later convert it to offset      */
70 /************************************************************************/
71
72 void*    emitCurBlock();
73 unsigned emitCurOffset();
74
75 UNATIVE_OFFSET emitCodeOffset(void* blockPtr, unsigned codeOffs);
76
77 #ifdef DEBUG
78 const char* emitOffsetToLabel(unsigned offs);
79 #endif // DEBUG
80
81 /************************************************************************/
82 /*                   Output target-independent instructions             */
83 /************************************************************************/
84
85 void emitIns_J(instruction ins, BasicBlock* dst, int instrCount = 0);
86
87 /************************************************************************/
88 /*                   Emit initialized data sections                     */
89 /************************************************************************/
90
91 UNATIVE_OFFSET emitDataGenBeg(UNATIVE_OFFSET size, bool dblAlign, bool codeLtab);
92
93 UNATIVE_OFFSET emitBBTableDataGenBeg(unsigned numEntries, bool relativeAddr);
94
95 void emitDataGenData(unsigned offs, const void* data, size_t size);
96
97 void emitDataGenData(unsigned offs, BasicBlock* label);
98
99 void emitDataGenEnd();
100
101 UNATIVE_OFFSET emitDataConst(const void* cnsAddr, unsigned cnsSize, bool dblAlign);
102
103 UNATIVE_OFFSET emitDataSize();
104
105 /************************************************************************/
106 /*                   Instruction information                            */
107 /************************************************************************/
108
109 #ifdef _TARGET_XARCH_
110 static bool instrIs3opImul(instruction ins);
111 static bool instrIsExtendedReg3opImul(instruction ins);
112 static bool instrHasImplicitRegPairDest(instruction ins);
113 static void      check3opImulValues();
114 static regNumber inst3opImulReg(instruction ins);
115 static instruction inst3opImulForReg(regNumber reg);
116 #endif
117
118 /************************************************************************/
119 /*                   Emit PDB offset translation information            */
120 /************************************************************************/
121
122 #ifdef TRANSLATE_PDB
123
124 static void SetILBaseOfCode(BYTE* pTextBase);
125 static void SetILMethodBase(BYTE* pMethodEntry);
126 static void SetILMethodStart(BYTE* pMethodCode);
127 static void SetImgBaseOfCode(BYTE* pTextBase);
128
129 void SetIDBaseToProlog();
130 void SetIDBaseToOffset(int methodOffset);
131
132 static void DisablePDBTranslation();
133 static bool IsPDBEnabled();
134
135 static void InitTranslationMaps(int ilCodeSize);
136 static void DeleteTranslationMaps();
137 static void InitTranslator(PDBRewriter* pPDB, int* rgSecMap, IMAGE_SECTION_HEADER** rgpHeader, int numSections);
138 #endif
139
140 /************************************************************************/
141 /*                   Interface for generating unwind information        */
142 /************************************************************************/
143
144 #ifdef _TARGET_ARMARCH_
145
146 bool emitIsFuncEnd(emitLocation* emitLoc, emitLocation* emitLocNextFragment = NULL);
147
148 void emitSplit(emitLocation*         startLoc,
149                emitLocation*         endLoc,
150                UNATIVE_OFFSET        maxSplitSize,
151                void*                 context,
152                emitSplitCallbackType callbackFunc);
153
154 void emitUnwindNopPadding(emitLocation* locFrom, Compiler* comp);
155
156 #endif // _TARGET_ARMARCH_
157
158 #if defined(_TARGET_ARM_)
159
160 unsigned emitGetInstructionSize(emitLocation* emitLoc);
161
162 #endif // defined(_TARGET_ARM_)