-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemoryOpt.h
More file actions
37 lines (31 loc) · 1.24 KB
/
Copy pathMemoryOpt.h
File metadata and controls
37 lines (31 loc) · 1.24 KB
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
// memory optimization: redundant-load elimination and store-to-load
// forwarding over the explicit memory-state edges of the SON,
// disambiguated by AliasAnalysis
//
// references:
// - C. Click and M. Paleczny, "A Simple Graph-Based Intermediate
// Representation", ACM SIGPLAN Workshop on IRs, 1995 (memory as a value)
// - F. Chow, S. Chan, S.-M. Liu, R. Lo and M. Streich, "Effective
// Representation of Aliases and Indirect Memory Operations in SSA Form",
// Compiler Construction (CC), 1996
#ifndef RAT_PASS_OPT_MEMORYOPT_H
#define RAT_PASS_OPT_MEMORYOPT_H
#include "Core.h"
#include "Pass/Pass.h"
namespace rat {
struct AliasAnalysis;
struct Function;
struct LoadNode;
struct Node;
struct MemoryOptPass : FunctionPass {
const C8* name() const override;
U32 runOnFunction(Function& fn) override;
private:
static U32 forwardStores(const AliasAnalysis& aa, const List<LoadNode*>& loads);
static U32 cseLoads(Function& fn, const AliasAnalysis& aa, const List<LoadNode*>& loads);
// skip back over stores that provably do not alias [addr, addr+size)
static Node* effectiveDef(const AliasAnalysis& aa, Node* mem, Node* addr, U32 size);
static Node* effectiveDef(const AliasAnalysis& aa, LoadNode* l);
};
} // namespace rat
#endif