Closed wjakob closed 1 year ago
@llvm/issue-subscribers-orcjit
Author: Wenzel Jakob (wjakob)
We can expose some frequently used APIs for TargetMachine
to the C-level.
typedef enum {
LLVMGlobalISelAbortDisable,
LLVMGlobalISelAbortEnable,
LLVMGlobalISelAbortDisableWithDiag,
} LLVMGlobalISelAbortMode;
void LLVMSetTargetMachineFastISel(LLVMTargetMachineRef T, LLVMBool Enable);
void LLVMSetTargetMachineO0WantsFastISel(LLVMTargetMachineRef T, LLVMBool Enable);
void LLVMSetTargetMachineGlobalISel(LLVMTargetMachineRef T, LLVMBool Enable);
void LLVMSetTargetMachineGlobalISelAbort(LLVMTargetMachineRef T, LLVMGlobalISelAbortMode Mode);
void LLVMSetTargetMachineMachineOutliner(LLVMTargetMachineRef T, LLVMBool Enable);
void LLVMSetTargetMachineSupportsDefaultOutlining(LLVMTargetMachineRef T, LLVMBool Enable);
void LLVMSetTargetMachineSupportsDebugEntryValues(LLVMTargetMachineRef T, LLVMBool Enable);
void LLVMSetTargetMachineCFIFixup(LLVMTargetMachineRef T, LLVMBool Enable);
That would be wonderful ❤️
Apologize for my misunderstanding. Some APIs/flags are designed to be used by targets instead of JIT users. I think exposing the following APIs makes sense.
/** Enable fast-path instruction selection. */
void LLVMSetTargetMachineFastISel(LLVMTargetMachineRef T, LLVMBool Enable);
/** Enable global instruction selection. */
void LLVMSetTargetMachineGlobalISel(LLVMTargetMachineRef T, LLVMBool Enable);
/** Set abort behaviour when global instruction selection fails to lower/select an instruction. */
void LLVMSetTargetMachineGlobalISelAbort(LLVMTargetMachineRef T, LLVMGlobalISelAbortMode Mode);
/** Enable the MachineOutliner pass. */
void LLVMSetTargetMachineMachineOutliner(LLVMTargetMachineRef T, LLVMBool Enable);
Dear LLVM team,
a while back, I ported an application from MCJIT to ORCv2/LLJIT (using the C bindings). One feature that was lost during this rewrite was the ability to control the method used to perform instruction selection. The MCJIT interface exposed this through a convenient parameter:
but no such thing exists for ORCv2/LLJIT (that I am aware of..).
Thus, I was wondering if there is any way to enable/disable
FastISel
for ORCv2/LLJIT, either using the C API or via annotations in the generated LLVM IR? I'd be really grateful for feedback from somebody familiar with this part of LLVM (@lhames?)PS: I saw that the
TargetMachine
C++ API has asetFastISel()
method, but it is likewise not exposed through the C-levelLLVMCreateTargetMachine
call.