aboutsummaryrefslogtreecommitdiff
path: root/all.h
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2016-10-04 12:02:39 -0400
committerQuentin Carbonneaux <[email protected]>2016-12-12 22:17:03 -0500
commit8fdea1dd5236f2693b677fc6bd6e2bb417c0fccd (patch)
treedd395aa367ebfe8c88dc2f5cbec719985c938195 /all.h
parent12f9d16c7b000030ce332778fa4d51d455ae819f (diff)
implement a simple alias analysis
Diffstat (limited to 'all.h')
-rw-r--r--all.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/all.h b/all.h
index 6b1951d..943480a 100644
--- a/all.h
+++ b/all.h
@@ -20,6 +20,7 @@ typedef struct Ins Ins;
typedef struct Phi Phi;
typedef struct Blk Blk;
typedef struct Use Use;
+typedef struct Alias Alias;
typedef struct Tmp Tmp;
typedef struct Con Con;
typedef struct Addr Mem;
@@ -104,8 +105,8 @@ struct Ref {
enum {
RTmp,
RCon,
- RSlot,
RType,
+ RSlot,
RCall,
RMem,
};
@@ -362,6 +363,26 @@ struct Use {
} u;
};
+enum {
+ NoAlias,
+ MayAlias,
+ MustAlias
+};
+
+struct Alias {
+ enum {
+ ABot = 0,
+ ALoc = 1, /* stack local */
+ ACon = 2,
+ AEsc = 3, /* stack escaping */
+ ASym = 4,
+ AUnk = 6,
+ } type;
+ Ref base;
+ char label[NString];
+ int64_t offset;
+};
+
struct Tmp {
char name[NString];
Use *use;
@@ -374,6 +395,7 @@ struct Tmp {
bits m;
} hint;
int phi;
+ Alias alias;
int visit;
};
@@ -534,6 +556,11 @@ void fillfron(Fn *);
/* mem.c */
void memopt(Fn *);
+/* alias.c */
+void fillalias(Fn *);
+int alias(Ref, int, Ref, int, int *, Fn *);
+int escapes(Ref, Fn *);
+
/* ssa.c */
void filluse(Fn *);
void fillpreds(Fn *);