Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bfcfaf3

Browse files
committed
Add constants to the Module
1 parent 7ef94c0 commit bfcfaf3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

‎src/Data/BitCode/LLVM.hs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ data Module = Module
6060
-- the existing values, doing so is
6161
-- rather expensive. And the constructor
6262
-- might be able to compute these directrly.
63+
, mConsts :: Set Symbol
6364
, mTypes :: Set Ty
6465
}
6566
deriving (Show, Eq, Generic)

‎src/Data/BitCode/LLVM/FromBitCode.hs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,14 @@ parseModule bs = do
477477

478478
typeSet <- Set.fromList <$> askTypeList
479479

480-
return $ Module version triple layout values functionDecl fns typeSet
480+
let isConstant x
481+
| (V.Constant{}) <- V.symbolValue x = True
482+
| otherwise = False
483+
484+
485+
constsSet <- Set.fromList . filter isConstant <$> askValueList
486+
487+
return $ Module version triple layout values functionDecl fns constsSet typeSet
481488
where
482489
functionBlocks :: [[NBitCode]]
483490
functionBlocks = [bs' | (B.FUNCTION, bs') <- blocks bs ]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /