Plan for pattern graph
This commit is contained in:
parent
3620d4ffc1
commit
ae1d962dff
@ -2,8 +2,29 @@
|
|||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
class LocationPattern {
|
class PatternNode {
|
||||||
|
public:
|
||||||
|
enum OP { NOP /* just move */, ADD, SUB, NEG, CALL, MEMREF };
|
||||||
|
private:
|
||||||
|
OP m_op;
|
||||||
|
public:
|
||||||
|
// ...
|
||||||
|
};
|
||||||
|
|
||||||
|
class PatternEdge {
|
||||||
|
public:
|
||||||
|
enum DATATYPE { VAR, CONST, FIELDOFF /* field offset is specialization of CONST */ };
|
||||||
|
private:
|
||||||
|
DATATYPE m_datatype;
|
||||||
|
// std::size_t m_datasize;
|
||||||
|
public:
|
||||||
|
// ...
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO -> build pattern tree from output root to input leafs
|
||||||
|
|
||||||
|
class LocationPattern {
|
||||||
|
// ...
|
||||||
public:
|
public:
|
||||||
LocationPattern() {}
|
LocationPattern() {}
|
||||||
~LocationPattern() {}
|
~LocationPattern() {}
|
||||||
@ -28,16 +49,10 @@ int register_gimple_statement_pattern(gimple_stmt_iterator* gsi) {
|
|||||||
LocationPattern& pattern = lp_it->second;
|
LocationPattern& pattern = lp_it->second;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
scan_stmt_for_offsetof(funcname, &gsi);
|
|
||||||
for (unsigned i = 0; i < gimple_num_ops(stmt); ++i) {
|
for (unsigned i = 0; i < gimple_num_ops(stmt); ++i) {
|
||||||
tree op = gimple_op(stmt, i);
|
tree op = gimple_op(stmt, i);
|
||||||
scan_tree_for_components(op, funcname, &gsi);
|
scan_tree_for_components(op, funcname, &gsi);
|
||||||
}
|
}
|
||||||
|
|
||||||
Build GimpleStatementPattern tree from individual gimple statement
|
|
||||||
Add GimpleStatementPattern to LocationPattern (attached at matching variable names (potentially unnamed ssa))
|
|
||||||
Patterns include markers for member offsets (type, member, value)
|
|
||||||
Later load a set of RTLInstructionPattern to match the patterns
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch (stmt_code) {
|
switch (stmt_code) {
|
||||||
@ -56,7 +71,7 @@ int register_gimple_statement_pattern(gimple_stmt_iterator* gsi) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void clean_unnecessary_patterns() {
|
void clean_unnecessary_patterns() {
|
||||||
// TODO
|
// TODO -> erase all that do not contain a single member offset
|
||||||
}
|
}
|
||||||
|
|
||||||
int register_rtl_instruction_pattern(rtx_insn* i) {
|
int register_rtl_instruction_pattern(rtx_insn* i) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user