summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-eliminate-phis.h
blob: 7a215bebd5b4abc80c50ab7c3f6b0022557ca4bc (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
// slang-ir-eliminate-phis.h
#pragma once

#include "slang-ir-liveness.h"

namespace Slang
{
struct CodeGenContext;
struct IRModule;

struct PhiEliminationOptions
{
    bool eliminateCompositeTypedPhiOnly = false;
    bool useRegisterAllocation = true;
    static PhiEliminationOptions getFast() { return PhiEliminationOptions{false, false}; }
};

/// Eliminate all "phi nodes" from the given `module`.
///
/// This process moves the code in `module` *out* of SSA form,
/// so that it is more suitable for emission on targets that
/// are not themselves based on an SSA representation.
///
/// If livenessMode is enabled LiveRangeStarts will be inserted into the module.
void eliminatePhis(LivenessMode livenessMode, IRModule* module, PhiEliminationOptions options);

void eliminatePhisInFunc(
    LivenessMode livenessMode,
    IRModule* module,
    IRGlobalValueWithCode* func,
    PhiEliminationOptions options);
} // namespace Slang