Skip to content

Commit

Permalink
[DOCS] fixing #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Cr0a3 committed Jul 18, 2024
1 parent 9d4f2de commit 1a17241
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ pub fn main() -> Result<(), Box<dyn Error>> {

module.verify().print();

module.runPassMngr(passes);

eprintln!("{}",
module.dumpColored()
);
Expand Down
11 changes: 2 additions & 9 deletions examples/simple.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::{error::Error, path::Path};
use Ygen::{prelude::*, PassManager::Passes::PreComputeValue};
use Ygen::prelude::*;

pub fn main() -> Result<(), Box<dyn Error>> {
let mut module = Module();
Expand All @@ -15,17 +15,10 @@ pub fn main() -> Result<(), Box<dyn Error>> {
builder.positionAtEnd(entry);

let val = builder.BuildAdd(ty.arg(0), ty.arg(1));
let add2 = builder.BuildAdd(Type::i32(5), Type::i32(5)); // If you wonder: this here tests the optimizer if it will be automaticly optimized out and inlined to 10
let ret = builder.BuildAdd(val, add2);
builder.BuildRet( ret );
builder.BuildRet( val );

module.verify().print();

let mut passes = PassManager::new();
passes.add( PreComputeValue() );

module.runPassMngr(passes);

eprintln!("{}",
module.dumpColored()
);
Expand Down

0 comments on commit 1a17241

Please sign in to comment.