blob: 1cfeb2deb3fc7be4908465be43c0756435a347c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//===============================================================================
#include "phase.h"
class Rationalizer : public Phase
{
private:
BasicBlock* m_block;
GenTreeStmt* m_statement;
public:
Rationalizer(Compiler* comp);
#ifdef DEBUG
static void ValidateStatement(GenTree* tree, BasicBlock* block);
// general purpose sanity checking of de facto standard GenTree
void SanityCheck();
// sanity checking of rationalized IR
void SanityCheckRational();
#endif // DEBUG
virtual void DoPhase() override;
static void RewriteAssignmentIntoStoreLcl(GenTreeOp* assignment);
static void MorphAsgIntoStoreObj(Compiler::fgWalkData* data, GenTreeStmt* stmt, GenTree** ppTree);
private:
inline LIR::Range& BlockRange() const
{
return LIR::AsRange(m_block);
}
// SIMD related
void RewriteSIMDOperand(LIR::Use& use, bool keepBlk);
void FixupIfSIMDLocal(GenTreeLclVarCommon* node);
// Intrinsic related transformations
void RewriteNodeAsCall(GenTree** use,
ArrayStack<GenTree*>& parents,
CORINFO_METHOD_HANDLE callHnd,
#ifdef FEATURE_READYTORUN_COMPILER
CORINFO_CONST_LOOKUP entryPoint,
#endif
GenTreeArgList* args);
void RewriteIntrinsicAsUserCall(GenTree** use, ArrayStack<GenTree*>& parents);
// Other transformations
void RewriteAssignment(LIR::Use& use);
void RewriteAddress(LIR::Use& use);
// Root visitor
Compiler::fgWalkResult RewriteNode(GenTree** useEdge, ArrayStack<GenTree*>& parents);
};
inline Rationalizer::Rationalizer(Compiler* _comp) : Phase(_comp, "IR Rationalize", PHASE_RATIONALIZE)
{
#ifdef DEBUG
comp->compNumStatementLinksTraversed = 0;
#endif
}
|