Skip to content
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

Rename the project to Hieratika #78

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 61 additions & 61 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ members = [
# Here we set keys that are relevant across all packages, allowing them to be inherited.
[workspace.package]
version = "0.1.0"
homepage = "https://github.com/reilabs/llvm-to-cairo"
repository = "https://github.com/reilabs/llvm-to-cairo"
homepage = "https://github.com/reilabs/hieratika"
repository = "https://github.com/reilabs/hieratika"
license-file = "LICENSE"

authors = ["Reilabs"]
Expand All @@ -34,11 +34,11 @@ bimap = { version = "0.6.3", features = ["serde"] }
clap = "4.5.16"
inkwell = { version = "0.5.0", features = ["llvm18-0"] }
itertools = "0.13.0"
ltc-cli = { path = "crates/cli" }
ltc-compiler = { path = "crates/compiler" }
ltc-driver = { path = "crates/driver" }
ltc-errors = { path = "crates/error" }
ltc-flo = { path = "crates/flo" }
hieratika-cli = { path = "crates/cli" }
hieratika-compiler = { path = "crates/compiler" }
hieratika-driver = { path = "crates/driver" }
hieratika-errors = { path = "crates/error" }
hieratika-flo = { path = "crates/flo" }
thiserror = "1.0.63"
tracing = "0.1.40"

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# LLVM on CairoVM
# Hieratika: Compiling LLVM to CairoVM

> **hieratiká /ˌhaɪ(ə)ˈɹætɪka/**, _adjective_
>
> Of or pertaining to the cursive writing system that developed alongside the hieroglyphic system as
> its handwritten counterpart for every-day use. It took the "priestly", domain-specific
> hieroglyphics and repurposed them for non-domain-specific expression.

This repository contains the efforts to enable compilation of LLVM bytecode to run on top of the
[CairoVM](https://github.com/lambdaclass/cairo-vm) and [Starknet](https://www.starknet.io). The
goals of this project are threefold:
[CairoVM](https://github.com/lambdaclass/cairo-vm) and hence [Starknet](https://www.starknet.io).
The goals of this project are threefold:

1. **Provable Rust Execution:** To provide the ability to prove the execution of LLVM bytecode using
Starknet's proving infrastructure, thereby allowing verification of said execution.
Expand Down
2 changes: 1 addition & 1 deletion crates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

In order to enable flexibility and reuse of components in other projects if required, this project
is designed as a set of component crates that assist in its operation. Please see the documentation
of the individual crates for more information on what they encompass.
of the individual crates for more information on what functionality they encompass.
8 changes: 4 additions & 4 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "ltc-cli"
name = "hieratika-cli"
version.workspace = true
homepage.workspace = true
repository.workspace = true
license-file.workspace = true

authors.workspace = true
description = "The CLI for working with the LLVM to Cairo compilation process."
description = "The CLI to allow users to interact with the Hieratika compilation process."
keywords.workspace = true
categories.workspace = true

Expand All @@ -16,10 +16,10 @@ rust-version.workspace = true
[dependencies]
ariadne.workspace = true
clap.workspace = true
hieratika-compiler.workspace = true
itertools.workspace = true
ltc-compiler.workspace = true
tracing.workspace = true

[[bin]]
name = "ltc" # Named for "LLVM To Cairo"
name = "hieratika"
path = "src/main.rs"
2 changes: 1 addition & 1 deletion crates/cli/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LLVM to Cairo CLI
# Hieratika CLI

This crate implements the CLI for interacting with the compiler and compilation process. It is
primarily a user interface wrapper over the [compiler driver](../driver).
2 changes: 1 addition & 1 deletion crates/cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This is the CLI driver for the compilation of LLVM IR to Cairo. For more
//! detail, please see the documentation for the [`ltc_compiler`] crate.
//! detail, please see the documentation for the [`hieratika_compiler`] crate.

#![warn(clippy::all, clippy::cargo, clippy::pedantic)]
#![allow(clippy::module_name_repetitions)] // Allows for better API naming
Expand Down
6 changes: 3 additions & 3 deletions crates/compiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "ltc-compiler"
name = "hieratika-compiler"
version.workspace = true
homepage.workspace = true
repository.workspace = true
Expand All @@ -21,8 +21,8 @@ derivative = "2.2.0"
downcast-rs = "1.2.1"
inkwell.workspace = true
itertools.workspace = true
ltc-errors.workspace = true
ltc-flo.workspace = true
hieratika-errors.workspace = true
hieratika-flo.workspace = true
ouroboros = "0.18.4"
tracing.workspace = true

Expand Down
7 changes: 4 additions & 3 deletions crates/compiler/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# LLVM to Cairo Compiler
# Hieratika Compiler

This crate implements the full compilation behavior from LLVM IR to `FlatLowered`, but no further
parts of the process. Those are combined using the [driver](../driver).
This crate implements the full compilation behavior from LLVM IR to our `.flo` object format, but no
further parts of the process. This is combined with the downstream linking and emission steps by the
[compiler driver](../driver).
12 changes: 6 additions & 6 deletions crates/compiler/input/add.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ target triple = "aarch64-unknown-none"
@alloc_4190527422e5cc48a15bd1cb4f38f425 = private unnamed_addr constant <{ [33 x i8] }> <{ [33 x i8] c"crates/rust-test-input/src/lib.rs" }>, align 1
@alloc_5b4544c775a23c08ca70c48dd7be27fc = private unnamed_addr constant <{ ptr, [16 x i8] }> <{ ptr @alloc_4190527422e5cc48a15bd1cb4f38f425, [16 x i8] c"!\00\00\00\00\00\00\00\05\00\00\00\05\00\00\00" }>, align 8

; ltc_rust_test_input::add
; hieratika_rust_test_input::add
; Function Attrs: noredzone nounwind
define dso_local i64 @_ZN19ltc_rust_test_input3add17h828e50e9267cb510E(i64 %left, i64 %right) unnamed_addr #0 !dbg !5 {
define dso_local i64 @_ZN19hieratika_rust_test_input3add17h828e50e9267cb510E(i64 %left, i64 %right) unnamed_addr #0 !dbg !5 {
start:
%right.dbg.spill = alloca [8 x i8], align 8
%left.dbg.spill = alloca [8 x i8], align 8
Expand Down Expand Up @@ -51,12 +51,12 @@ attributes #3 = { noreturn nounwind }

!0 = !{!"rustc version 1.81.0 (eeb90cda1 2024-09-04)"}
!1 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !2, producer: "clang LLVM (rustc version 1.81.0 (eeb90cda1 2024-09-04))", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
!2 = !DIFile(filename: "crates/rust-test-input/src/lib.rs/@/9ox3ykpp0gbrqxqlz7ajwa9w6", directory: "/Users/starfire/Development/reilabs/starkware/llvm-to-cairo")
!2 = !DIFile(filename: "crates/rust-test-input/src/lib.rs/@/9ox3ykpp0gbrqxqlz7ajwa9w6", directory: "/Users/starfire/Development/reilabs/starkware/hieratika")
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = distinct !DISubprogram(name: "add", linkageName: "_ZN19ltc_rust_test_input3add17h828e50e9267cb510E", scope: !7, file: !6, line: 4, type: !8, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !1, templateParams: !14, retainedNodes: !11)
!6 = !DIFile(filename: "crates/rust-test-input/src/lib.rs", directory: "/Users/starfire/Development/reilabs/starkware/llvm-to-cairo", checksumkind: CSK_MD5, checksum: "178b5b568f49bd1e17834a7529756af1")
!7 = !DINamespace(name: "ltc_rust_test_input", scope: null)
!5 = distinct !DISubprogram(name: "add", linkageName: "_ZN19hieratika_rust_test_input3add17h828e50e9267cb510E", scope: !7, file: !6, line: 4, type: !8, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !1, templateParams: !14, retainedNodes: !11)
!6 = !DIFile(filename: "crates/rust-test-input/src/lib.rs", directory: "/Users/starfire/Development/reilabs/starkware/hieratika", checksumkind: CSK_MD5, checksum: "178b5b568f49bd1e17834a7529756af1")
!7 = !DINamespace(name: "hieratika_rust_test_input", scope: null)
!8 = !DISubroutineType(types: !9)
!9 = !{!10, !10, !10}
!10 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned)
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/src/context/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Contains the source compilation context, which is a way of tracking the
//! compilation units being processed by the compiler.

use hieratika_errors::compile::{Error, Result};
use inkwell::{context::Context as LLVMContext, module::Module};
use ltc_errors::compile::{Error, Result};
use ouroboros::self_referencing;

pub mod module;
Expand Down
12 changes: 6 additions & 6 deletions crates/compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub mod llvm;
pub mod pass;
pub mod polyfill;

use ltc_errors::compile::{Error, Result};
use ltc_flo::FlatLoweredObject;
use hieratika_errors::compile::{Error, Result};
use hieratika_flo::FlatLoweredObject;

use crate::{
context::SourceContext,
Expand All @@ -62,8 +62,8 @@ use crate::{
/// Handles the compilation of LLVM IR to our [`FlatLoweredObject`] object
/// format.
///
/// In the context of LLVM to Cairo, compilation refers to the process of
/// translating from [LLVM IR](https://llvm.org/docs/LangRef.html) to our
/// In the context of the Hieratika project, compilation refers to the process
/// of translating from [LLVM IR](https://llvm.org/docs/LangRef.html) to our
/// internal `FLO` object file format.
///
/// LLVM IR is designed around a virtual processor model that is expected to
Expand Down Expand Up @@ -144,8 +144,8 @@ impl Compiler {
///
/// # Errors
///
/// - [`ltc_errors::compile::Error`] if the compilation process fails for
/// any reason.
/// - [`hieratika_errors::compile::Error`] if the compilation process fails
/// for any reason.
pub fn run(mut self) -> Result<CompilationResult> {
let PassManagerReturnData {
context: _context,
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/src/llvm/data_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use chumsky::{
prelude::{choice, just},
Parser,
};
use ltc_errors::compile::{Error, Result};
use hieratika_errors::compile::{Error, Result};

use crate::constant::{
BYTE_SIZE,
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/src/llvm/typesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use std::fmt::{Display, Formatter};

use hieratika_errors::{compile, compile::Error};
use inkwell::types::{
AnyTypeEnum,
ArrayType,
Expand All @@ -16,7 +17,6 @@ use inkwell::types::{
VoidType,
};
use itertools::Itertools;
use ltc_errors::{compile, compile::Error};

use crate::constant::BYTE_SIZE;

Expand Down
10 changes: 6 additions & 4 deletions crates/compiler/src/pass/analysis/module_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

use std::collections::HashMap;

use hieratika_errors::compile::{Error, Result};
use inkwell::{
module::{Linkage, Module},
values::{FunctionValue, GlobalValue},
GlobalVisibility,
};
use ltc_errors::compile::{Error, Result};

use crate::{
context::SourceContext,
Expand Down Expand Up @@ -439,7 +439,9 @@ mod test {

// Functions, though technically globals, should not be seen
assert!(
!globals.contains_key(&"_ZN19ltc_rust_test_input3add17h828e50e9267cb510E".to_string())
!globals.contains_key(
&"_ZN19hieratika_rust_test_input3add17h828e50e9267cb510E".to_string()
)
);
assert!(!globals.contains_key(&"llvm.dbg.declare".to_string()));
assert!(!globals.contains_key(&"llvm.uadd.with.overflow.i64".to_string()));
Expand Down Expand Up @@ -506,9 +508,9 @@ mod test {
assert!(!functions.contains_key(&"alloc_4190527422e5cc48a15bd1cb4f38f425".to_string()));
assert!(!functions.contains_key(&"alloc_5b4544c775a23c08ca70c48dd7be27fc".to_string()));

// _ZN19ltc_rust_test_input3add17h828e50e9267cb510E
// _ZN19hieratika_rust_test_input3add17h828e50e9267cb510E
let rust_test_input = functions
.get(&"_ZN19ltc_rust_test_input3add17h828e50e9267cb510E".to_string())
.get(&"_ZN19hieratika_rust_test_input3add17h828e50e9267cb510E".to_string())
.unwrap();
assert!(!rust_test_input.intrinsic);
assert_eq!(rust_test_input.kind, TopLevelEntryKind::Definition);
Expand Down
Loading
Loading