Rewrite init() interpretation to a real interpreter

Instead of mostly heuristics, actually execute the init() instruction in
an interpreter to calculate initializers for globals. This is far more
flexible and extensible, and gives the option of extending the
interpreter to other code and make it a partial evaluator.
This commit is contained in:
Ayke van Laethem
2018-08-25 01:14:33 +02:00
parent 9b4ac0459b
commit c25b448758
3 changed files with 553 additions and 338 deletions
+4 -3
View File
@@ -38,9 +38,10 @@ type Function struct {
// Global variable, possibly constant.
type Global struct {
g *ssa.Global
llvmGlobal llvm.Value
flag bool // used by dead code elimination
g *ssa.Global
llvmGlobal llvm.Value
flag bool // used by dead code elimination
initializer Value
}
// Type with a name and possibly methods.