-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARROW-7819: [C++][Gandiva] Add DumpIR to Filter/Projector object
The following patch exposes the generated IR as a method of the objects for further inspection. This is a breaking change for the internal method `FinalizeModule` which doesn't take the dump_ir and optimize flags, it receives `optimize` from Configuration now. - Refactored Engine, notably removed dead code, organized init in a single function and simplified LLVMGenerator. - Dumping IR should not write to stdout, but instead return it as a string in the `DumpIR` method. - Refactored Types, fixing some bad methods type. - Added the optimize field to `Configuration` class. - Simplified some unit tests. But more importantly, we can now inspect dynamically: ```python >>> filter = gandiva.make_filter(table.schema, condition) >>> print(filter.ir) ; ModuleID = 'codegen' source_filename = "codegen" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer @_ZN5arrow7BitUtilL8kBitmaskE = internal unnamed_addr constant [8 x i8] c"\01\02\04\08\10 @\80", align 1 ; Function Attrs: norecurse nounwind define i32 @expr_0_0(i64* nocapture readonly %args, i64* nocapture readonly %arg_addr_offsets, i64* nocapture readnone %local_bitmaps, i16* nocapture readnone %selection_vector, i64 %context_ptr, i64 %nrecords) local_unnamed_addr #0 { entry: %0 = bitcast i64* %args to i8** %cond_mem56 = load i8*, i8** %0, align 8 %1 = getelementptr i64, i64* %arg_addr_offsets, i64 3 %2 = load i64, i64* %1, align 8 %a_mem_addr = getelementptr i64, i64* %args, i64 3 %3 = bitcast i64* %a_mem_addr to double** %a_mem7 = load double*, double** %3, align 8 %scevgep = getelementptr double, double* %a_mem7, i64 %2 br label %loop loop: ; preds = %loop, %entry %loop_var = phi i64 [ 0, %entry ], [ %"loop_var+1", %loop ] %scevgep8 = getelementptr double, double* %scevgep, i64 %loop_var %a = load double, double* %scevgep8, align 8 %4 = fcmp olt double %a, 1.000000e+03 %5 = sext i1 %4 to i8 ``` Closes #6417 from fsaintjacques/ARROW-7819-gandiva-dump-ir-tool and squashes the following commits: c8d274f <François Saint-Jacques> Address comments 0bcebc8 <François Saint-Jacques> ARROW-7819: Add DumpIR to Filter/Projector object Authored-by: François Saint-Jacques <fsaintjacques@gmail.com> Signed-off-by: Wes McKinney <wesm+git@apache.org>
- Loading branch information
1 parent
6e14384
commit 52255a1
Showing
16 changed files
with
286 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
This include seems like it isn't necessary?