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

Add --print-ir-before-all command line argument #31

Merged
merged 10 commits into from
Dec 7, 2024
Merged

Conversation

rikhuijzer
Copy link
Owner

@rikhuijzer rikhuijzer commented Dec 6, 2024

Adds --print-ir-before-all to the default command line arguments.

The following example gives the same output in arnoldc and xrcf-bin:

tmp.mlir:

func.func @main() -> i32 {
    %0 = arith.constant 1 : i32
    return %0 : i32
}

with

$ xrcf-bin \
    --convert-func-to-llvm \
    --convert-mlir-to-llvmir \
    tmp.mlir \
    --print-ir-before-all

prints

// ----- // IR Dump before convert-func-to-llvm //----- //
module {
  func.func @main() -> i32 {
    %0 = arith.constant 1 : i32
    return %0 : i32
  }
}


// ----- // IR Dump before convert-mlir-to-llvmir //----- //
module {
  llvm.func @main() -> i32 {
    %0 = llvm.mlir.constant(1 : i32) : i32
    llvm.return %0 : i32
  }
}


; ModuleID = 'LLVMDialectModule'
source_filename = "LLVMDialectModule"

define i32 @main() {
  ret i32 1
}

!llvm.module.flags = !{!0}

!0 = !{i32 2, !"Debug Info Version", i32 3}

where the dumps are sent to stderr similar to mlir-opt.

@rikhuijzer rikhuijzer changed the title Add print ir flag Add --print-ir-before-all command line argument Dec 7, 2024
@rikhuijzer rikhuijzer merged commit aecd119 into main Dec 7, 2024
7 checks passed
@rikhuijzer rikhuijzer deleted the rh/print-ir branch December 7, 2024 10:49
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

Successfully merging this pull request may close these issues.

1 participant