Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reinier Maas
GHC
Commits
a6a38742
Commit
a6a38742
authored
1 year ago
by
Ben Gamari
Committed by
Marge Bot
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
llvmGen: Introduce infrastructure for module flag metadata
parent
86ce92a2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
compiler/GHC/Llvm.hs
+4
-0
4 additions, 0 deletions
compiler/GHC/Llvm.hs
compiler/GHC/Llvm/MetaData.hs
+43
-0
43 additions, 0 deletions
compiler/GHC/Llvm/MetaData.hs
with
47 additions
and
0 deletions
compiler/GHC/Llvm.hs
+
4
−
0
View file @
a6a38742
...
...
@@ -42,6 +42,10 @@ module GHC.Llvm (
-- ** Metadata types
MetaExpr
(
..
),
MetaAnnot
(
..
),
MetaDecl
(
..
),
MetaId
(
..
),
-- *** Module flags
ModuleFlagBehavior
(
..
),
ModuleFlag
(
..
),
moduleFlagToMetaExpr
,
-- ** Operations on the type system.
isGlobal
,
getLitType
,
getVarType
,
...
...
This diff is collapsed.
Click to expand it.
compiler/GHC/Llvm/MetaData.hs
+
43
−
0
View file @
a6a38742
...
...
@@ -6,6 +6,10 @@ module GHC.Llvm.MetaData
,
MetaExpr
(
..
)
,
MetaAnnot
(
..
)
,
MetaDecl
(
..
)
-- * Module flags
,
ModuleFlagBehavior
(
..
)
,
ModuleFlag
(
..
)
,
moduleFlagToMetaExpr
)
where
import
GHC.Prelude
...
...
@@ -98,3 +102,42 @@ data MetaDecl
-- | Metadata node declaration.
-- ('!0 = metadata !{ \<metadata expression> }' form).
|
MetaUnnamed
!
MetaId
!
MetaExpr
----------------------------------------------------------------
-- Module flags
----------------------------------------------------------------
data
ModuleFlagBehavior
=
MFBError
|
MFBWarning
|
MFBRequire
|
MFBOverride
|
MFBAppend
|
MFBAppendUnique
|
MFBMax
|
MFBMin
moduleFlagBehaviorToMetaExpr
::
ModuleFlagBehavior
->
MetaExpr
moduleFlagBehaviorToMetaExpr
mfb
=
MetaLit
$
LMIntLit
n
i32
where
n
=
case
mfb
of
MFBError
->
1
MFBWarning
->
2
MFBRequire
->
3
MFBOverride
->
4
MFBAppend
->
5
MFBAppendUnique
->
6
MFBMax
->
7
MFBMin
->
8
data
ModuleFlag
=
ModuleFlag
{
mfBehavior
::
ModuleFlagBehavior
,
mfName
::
LMString
,
mfValue
::
MetaExpr
}
moduleFlagToMetaExpr
::
ModuleFlag
->
MetaExpr
moduleFlagToMetaExpr
flag
=
MetaStruct
[
moduleFlagBehaviorToMetaExpr
(
mfBehavior
flag
)
,
MetaStr
(
mfName
flag
)
,
mfValue
flag
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment