blob: e3db559d73727d6fd5a4b7dd375d278ab8dfee36 (
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
|
// slang-ir-ssa-simplification.h
#pragma once
#include "slang-ir-dce.h"
#include "slang-ir-peephole.h"
#include "slang-ir-simplify-cfg.h"
namespace Slang
{
struct IRModule;
struct IRGlobalValueWithCode;
class DiagnosticSink;
class TargetProgram;
struct IRSimplificationOptions
{
CFGSimplificationOptions cfgOptions;
PeepholeOptimizationOptions peepholeOptions;
IRDeadCodeEliminationOptions deadCodeElimOptions;
bool minimalOptimization = false;
bool removeRedundancy = false;
bool hoistLoopInvariantInsts = false;
static IRSimplificationOptions getDefault(TargetProgram* targetProgram);
static IRSimplificationOptions getFast(TargetProgram* targetProgram);
};
// Run a combination of SSA, SCCP, SimplifyCFG, and DeadCodeElimination pass
// until no more changes are possible.
void simplifyIR(
TargetProgram* target,
IRModule* module,
IRSimplificationOptions options,
DiagnosticSink* sink = nullptr);
// Run simplifications on IR that is out of SSA form.
void simplifyNonSSAIR(TargetProgram* target, IRModule* module, IRSimplificationOptions options);
void simplifyFunc(
TargetProgram* target,
IRGlobalValueWithCode* func,
IRSimplificationOptions options,
DiagnosticSink* sink = nullptr);
} // namespace Slang
|