Plan for pattern graph
This commit is contained in:
parent
3620d4ffc1
commit
ae1d962dff
@ -2,8 +2,29 @@
|
||||
|
||||
#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:
|
||||
LocationPattern() {}
|
||||
~LocationPattern() {}
|
||||
@ -28,35 +49,29 @@ int register_gimple_statement_pattern(gimple_stmt_iterator* gsi) {
|
||||
LocationPattern& pattern = lp_it->second;
|
||||
|
||||
/*
|
||||
scan_stmt_for_offsetof(funcname, &gsi);
|
||||
for (unsigned i = 0; i < gimple_num_ops(stmt); ++i) {
|
||||
tree op = gimple_op(stmt, i);
|
||||
scan_tree_for_components(op, funcname, &gsi);
|
||||
}
|
||||
for (unsigned i = 0; i < gimple_num_ops(stmt); ++i) {
|
||||
tree op = gimple_op(stmt, i);
|
||||
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) {
|
||||
case GIMPLE_CALL:
|
||||
// check for offsetof, then fall through to operand scanning
|
||||
case GIMPLE_ASSIGN:
|
||||
case GIMPLE_COND:
|
||||
case GIMPLE_LABEL:
|
||||
case GIMPLE_RETURN:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (stmt_code) {
|
||||
case GIMPLE_CALL:
|
||||
// check for offsetof, then fall through to operand scanning
|
||||
case GIMPLE_ASSIGN:
|
||||
case GIMPLE_COND:
|
||||
case GIMPLE_LABEL:
|
||||
case GIMPLE_RETURN:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void clean_unnecessary_patterns() {
|
||||
// TODO
|
||||
// TODO -> erase all that do not contain a single member offset
|
||||
}
|
||||
|
||||
int register_rtl_instruction_pattern(rtx_insn* i) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user