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

Support for lowering goto dialect into llvm IR #772

Open
1 task done
kumarak opened this issue Feb 1, 2025 · 0 comments
Open
1 task done

Support for lowering goto dialect into llvm IR #772

kumarak opened this issue Feb 1, 2025 · 0 comments

Comments

@kumarak
Copy link
Member

kumarak commented Feb 1, 2025

Prerequisites

  • I have read the documentation and the proposed feature is not implemented.

Description

Vast IRsToLLVM pass does not support replacement of high-level goto dialect and it is marked illegal. I see the following error while generating llvm ir from code snippet containing goto.

test.c:6:5: error: unexpected error: failed to legalize operation 'hl.goto' that was explicitly marked illegal
    goto basic_0;
    ^
test.c:6:5: error: unexpected note: see current operation: "hl.goto"(%0) : (!hl.label) -> ()
    goto basic_0;
    ^
// -----// IR Dump After IRsToLLVM Failed (vast-irs-to-llvm) //----- //
module {
  core.module @"/Users/akshayk/Documents/workspace/demo/vast/build/test.c" attributes {dlti.dl_spec = #dlti.dl_spec<>, vast.core.lang = #core<lang c>, vast.core.target_triple = "arm64-apple-macosx15.0.0"} {
    hl.var @var_error, <internal>  sc_static : !hl.ptr<ui32>
    hl.var @var_1, <internal>  sc_static : !hl.ptr<ui32>
    ll.func @func external () -> ui32 {
      %0 = hl.label.decl @basic_0 : !hl.label
      %1 = hl.label.decl @basic_2 : !hl.label
      %2 = hl.label.decl @basic_1 : !hl.label
      %3 = ll.alloca : !hl.ptr<ui32>
      hl.goto %0
      hl.label %1 {
        %5 = hl.const #core.integer<0> : ui32
        ll.store %3, %5 : !hl.ptr<ui32>, ui32
      }
      %4 = ll.load %3 : (!hl.ptr<ui32>) -> ui32
      ll.return %4 : ui32
    }
  }
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant