Fix reading Time zone rules using Julian days (#17672)
[platform/upstream/coreclr.git] / src / jit / rationalize.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 #include "phase.h"
7
8 class Rationalizer : public Phase
9 {
10 private:
11     BasicBlock*  m_block;
12     GenTreeStmt* m_statement;
13
14 public:
15     Rationalizer(Compiler* comp);
16
17 #ifdef DEBUG
18     static void ValidateStatement(GenTree* tree, BasicBlock* block);
19
20     // general purpose sanity checking of de facto standard GenTree
21     void SanityCheck();
22
23     // sanity checking of rationalized IR
24     void SanityCheckRational();
25
26 #endif // DEBUG
27
28     virtual void DoPhase() override;
29
30     static void RewriteAssignmentIntoStoreLcl(GenTreeOp* assignment);
31     static void MorphAsgIntoStoreObj(Compiler::fgWalkData* data, GenTreeStmt* stmt, GenTree** ppTree);
32
33 private:
34     inline LIR::Range& BlockRange() const
35     {
36         return LIR::AsRange(m_block);
37     }
38
39     // SIMD related
40     void RewriteSIMDOperand(LIR::Use& use, bool keepBlk);
41     void FixupIfSIMDLocal(GenTreeLclVarCommon* node);
42
43     // Intrinsic related transformations
44     void RewriteNodeAsCall(GenTree**             use,
45                            ArrayStack<GenTree*>& parents,
46                            CORINFO_METHOD_HANDLE callHnd,
47 #ifdef FEATURE_READYTORUN_COMPILER
48                            CORINFO_CONST_LOOKUP entryPoint,
49 #endif
50                            GenTreeArgList* args);
51
52     void RewriteIntrinsicAsUserCall(GenTree** use, ArrayStack<GenTree*>& parents);
53
54     // Other transformations
55     void RewriteAssignment(LIR::Use& use);
56     void RewriteAddress(LIR::Use& use);
57
58     // Root visitor
59     Compiler::fgWalkResult RewriteNode(GenTree** useEdge, ArrayStack<GenTree*>& parents);
60 };
61
62 inline Rationalizer::Rationalizer(Compiler* _comp) : Phase(_comp, "IR Rationalize", PHASE_RATIONALIZE)
63 {
64 #ifdef DEBUG
65     comp->compNumStatementLinksTraversed = 0;
66 #endif
67 }