Skip to content

Commit

Permalink
Warning for #341
Browse files Browse the repository at this point in the history
  • Loading branch information
Pat-Lafon committed Oct 24, 2024
1 parent 61c119e commit ad2b6e9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 8 additions & 1 deletion bril-rs/brillvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ be updated as Inkwell gets new support, within the constraints of the rust compi

## Runtime

You must have a linkable runtime library available in the LLVM bc format. You can get this by calling `make rt`
You must have a linkable runtime library available in the LLVM bc format.
You can get this by calling `make rt`.

## Usage

Expand Down Expand Up @@ -38,6 +39,12 @@ the LLVM `mem2reg` pass will be sufficient if that is needed) but if you choose
to supply Bril code with `phi` operations, Brillvm will assume that they follow
LLVM's additional constraints.

### Limitations

- Rust and Bril both allow variables to be re-declared with different types. Brillvm
does not yet support this and assumes that a given variable will only have one
type within a function.

## TroubleShooting

### Floating Point values
Expand Down
9 changes: 7 additions & 2 deletions bril-rs/brillvm/src/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,15 @@ impl<'a, 'b> Heap<'a, 'b> {
name: &'b String,
ty: &Type,
) -> WrappedPointer<'a> {
self.map
let result = self.map
.entry(name)
.or_insert_with(|| WrappedPointer::new(builder, context, name, ty))
.clone()
.clone();
if result.ty != *ty {
println!("`{}` had type `{}` but is now being assigned type `{}`", name, result.ty, ty);
unimplemented!("brillvm does not currently support variables within a function having different types. Implementing this might require a control flow analysis? Feel free to try and implement this.")
}
result
}

fn get(&self, name: &String) -> WrappedPointer<'a> {
Expand Down

0 comments on commit ad2b6e9

Please sign in to comment.