-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change handling of global variables #97
Conversation
Instead of providing a CFG that initializes all global variables, the result of translating a module now contains a map from symbols (the name of the global) to their initializers (represented as a constant LLVM value). Clients to this API (e.g. saw-script) can now initialize globals at will by turning them into LLVM expressions.
This isn't quite ready to merge, I want to find a better home for the |
, _transContext :: LLVMContext arch | ||
, globalMap :: GlobalInitializerMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be renamed to globalInitMap
, it conflicts with Lang.Crucible.Simulator.SymGlobalState.globalMap
.
-- | ||
-- To actually initialize globals, saw-script translates them into | ||
-- instances of @MemModel.LLVMVal@. | ||
type GlobalInitializerMap = Map L.Symbol (Either String LLVMConst) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This map should probably contain more information than it does (optimally, anything someone down the road would want to know about a given global). The least "lossy" way of doing this is probably
type GlobalInitializerMap = Map L.Global (Either String LLVMConst)
It now retains the entire L.Global. Additionally, fix a bug in zeroExpand'
Note: This is highly backwards-incompatible. SAW scripts that used to run will no longer with this change! Should we make a release note, or something similar? I've bumped the version so that library clients can select which behavior they need.
Instead of providing a CFG that initializes all global variables, the result of translating a module now contains a map from symbols (the name of the global) to their initializers (represented as a constant LLVM value).
Clients to this API (e.g. saw-script) can now initialize globals at will by turning them into LLVM expressions.
Enables progress on GaloisInc/saw-script#203.