Skip to content

Commit

Permalink
Merge pull request #12 from lambdaclass/progress
Browse files Browse the repository at this point in the history
makefile
  • Loading branch information
edg-l authored Dec 9, 2024
2 parents 0737e15 + 6adea3a commit 70c646c
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/target

out.a
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: deps
deps:
brew install -q llvm@19

build:
cargo build

run:
cargo run -- test.prog -o out.a
13 changes: 12 additions & 1 deletion docs/src/workshop_p1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@

## Project Setup

### Dependencies
### Easy way

```bash
git clone https://github.com/lambdaclass/mlir-workshop
cd mlir-workshop
make deps
source env.sh
make build
```

### Dependencies (manual way)
- Rust
- LLVM and MLIR


To install LLVM and MLIR you can do so through brew:

`brew install llvm@19` (This workshop uses LLVM/MLIR 19)
Expand Down
3 changes: 3 additions & 0 deletions env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export MLIR_SYS_190_PREFIX="$(brew --prefix llvm@19)"
export LLVM_SYS_191_PREFIX="$(brew --prefix llvm@19)"
export TABLEGEN_190_PREFIX="$(brew --prefix llvm@19)"
9 changes: 3 additions & 6 deletions src/codegen/ifelse_stmt.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use std::{collections::HashMap, ops::Deref};
use std::collections::HashMap;

use melior::{
dialect::scf,
ir::{Block, BlockRef, Region, Value},
};
use melior::ir::{Block, Value};

use crate::ast::IfStmt;

use super::{expressions::compile_expr, ModuleCtx};
use super::ModuleCtx;

pub fn compile_if<'ctx, 'parent>(
ctx: &ModuleCtx<'ctx>,
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/let_stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use melior::ir::{Block, Value};

use crate::ast::LetStmt;

use super::{expressions::compile_expr, ModuleCtx};
use super::ModuleCtx;

pub fn compile_let<'ctx: 'parent, 'parent>(
ctx: &ModuleCtx<'ctx>,
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ struct Args {
output: PathBuf,

/// Number of times to greet
#[arg(short, long, default_value_t = 3)]
optlevel: u8,
#[arg(long, default_value_t = 3)]
opt_level: u8,
}

fn main() {
Expand All @@ -54,5 +54,5 @@ fn main() {
module: &module,
};

compile_program(&ctx, &program, args.optlevel.into(), &args.output);
compile_program(&ctx, &program, args.opt_level.into(), &args.output);
}

0 comments on commit 70c646c

Please sign in to comment.