Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hercules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
Hercules
Commits
a081f003
Commit
a081f003
authored
1 year ago
by
Russel Arbore
Browse files
Options
Downloads
Patches
Plain Diff
Some starter code for IR def
parent
523df6ac
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Cargo.lock
+25
-0
25 additions, 0 deletions
Cargo.lock
hercules_ir/Cargo.toml
+3
-0
3 additions, 0 deletions
hercules_ir/Cargo.toml
hercules_ir/src/ir.rs
+137
-0
137 additions, 0 deletions
hercules_ir/src/ir.rs
hercules_ir/src/lib.rs
+3
-0
3 additions, 0 deletions
hercules_ir/src/lib.rs
with
168 additions
and
0 deletions
Cargo.lock
+
25
−
0
View file @
a081f003
...
@@ -5,3 +5,28 @@ version = 3
...
@@ -5,3 +5,28 @@ version = 3
[[package]]
[[package]]
name = "hercules_ir"
name = "hercules_ir"
version = "0.1.0"
version = "0.1.0"
dependencies = [
"nom",
]
[[package]]
name = "memchr"
version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
This diff is collapsed.
Click to expand it.
hercules_ir/Cargo.toml
+
3
−
0
View file @
a081f003
...
@@ -2,3 +2,6 @@
...
@@ -2,3 +2,6 @@
name
=
"hercules_ir"
name
=
"hercules_ir"
version
=
"0.1.0"
version
=
"0.1.0"
authors
=
[
"Russel Arbore <rarbore2@illinois.edu>"
]
authors
=
[
"Russel Arbore <rarbore2@illinois.edu>"
]
[dependencies]
nom
=
"*"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
hercules_ir/src/ir.rs
0 → 100644
+
137
−
0
View file @
a081f003
pub
struct
FunctionID
(
u32
);
pub
struct
NodeID
(
u32
);
const
NULL_NODE
:
NodeID
=
NodeID
(
0xFFFFFFFF
);
pub
struct
ConstantID
(
u32
);
pub
struct
TypeID
(
u32
);
pub
struct
Module
{
functions
:
Vec
<
Function
>
,
typed
:
Vec
<
Type
>
,
constants
:
Vec
<
Constant
>
,
}
pub
struct
Function
{
name
:
String
,
nodes
:
Vec
<
Node
>
,
}
pub
enum
Type
{
Control
,
Integer8
,
Integer16
,
Integer32
,
Integer64
,
Float32
,
Float64
,
}
pub
enum
Constant
{
Integer8
(
u8
),
Integer16
(
u16
),
Integer32
(
u32
),
Integer64
(
u64
),
Float32
(
f32
),
Float64
(
f64
),
}
pub
enum
Node
{
Start
,
Region
{
preds
:
Box
<
[
NodeID
]
>
,
},
If
{
control
:
NodeID
,
cond
:
NodeID
,
},
Phi
{
control
:
NodeID
,
data
:
Box
<
[
NodeID
]
>
,
},
Return
{
control
:
NodeID
,
value
:
NodeID
,
},
Constant
{
id
:
ConstantID
,
},
Add
{
control
:
NodeID
,
left
:
NodeID
,
right
:
NodeID
,
},
Sub
{
control
:
NodeID
,
left
:
NodeID
,
right
:
NodeID
,
},
Mul
{
control
:
NodeID
,
left
:
NodeID
,
right
:
NodeID
,
},
Div
{
control
:
NodeID
,
left
:
NodeID
,
right
:
NodeID
,
},
Call
{
args
:
Box
<
[
NodeID
]
>
,
},
}
impl
From
<
u32
>
for
FunctionID
{
fn
from
(
v
:
u32
)
->
Self
{
FunctionID
(
v
)
}
}
impl
From
<
u64
>
for
FunctionID
{
fn
from
(
v
:
u64
)
->
Self
{
FunctionID
(
v
as
u32
)
}
}
impl
From
<
usize
>
for
FunctionID
{
fn
from
(
v
:
usize
)
->
Self
{
FunctionID
(
v
as
u32
)
}
}
impl
From
<
u32
>
for
NodeID
{
fn
from
(
v
:
u32
)
->
Self
{
NodeID
(
v
)
}
}
impl
From
<
u64
>
for
NodeID
{
fn
from
(
v
:
u64
)
->
Self
{
NodeID
(
v
as
u32
)
}
}
impl
From
<
usize
>
for
NodeID
{
fn
from
(
v
:
usize
)
->
Self
{
NodeID
(
v
as
u32
)
}
}
impl
From
<
u32
>
for
ConstantID
{
fn
from
(
v
:
u32
)
->
Self
{
ConstantID
(
v
)
}
}
impl
From
<
u64
>
for
ConstantID
{
fn
from
(
v
:
u64
)
->
Self
{
ConstantID
(
v
as
u32
)
}
}
impl
From
<
usize
>
for
ConstantID
{
fn
from
(
v
:
usize
)
->
Self
{
ConstantID
(
v
as
u32
)
}
}
This diff is collapsed.
Click to expand it.
hercules_ir/src/lib.rs
+
3
−
0
View file @
a081f003
pub
mod
ir
;
pub
use
crate
::
ir
::
*
;
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