Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4240fd5
Prepare basic GlobalISel setup and implement CallLowering::lowerForma…
QuantumSegfault Sep 29, 2025
527abeb
Implement WebAssemblyCallLowering::lowerCall
QuantumSegfault Sep 29, 2025
17e2e8d
Fix formatting
QuantumSegfault Sep 29, 2025
4ce15bb
Fix some issues with WebAssemblyCallLowering::lowerCall
QuantumSegfault Sep 29, 2025
744cf5a
Attempt to make CallLowering floating-point aware (use FPEXT and FPTR…
QuantumSegfault Sep 29, 2025
af74b74
Fix lowerCall vararg crash.
QuantumSegfault Sep 29, 2025
b11c192
Set up basic legalization (scalar only, limited support for FP, p0 only)
QuantumSegfault Sep 29, 2025
9b06b7e
start on regbankselect
QuantumSegfault Sep 29, 2025
177340b
Finish initial pass over regbankselect
QuantumSegfault Sep 29, 2025
5d8f652
Begin work on instruction selection
QuantumSegfault Oct 2, 2025
4ffd964
Instruction selection wave 2
QuantumSegfault Oct 3, 2025
e5708dd
Fix error due to difference HwMode signature
QuantumSegfault Oct 6, 2025
1930523
Setup combiners
QuantumSegfault Oct 9, 2025
67733b3
Implement more floating-point ops
QuantumSegfault Oct 10, 2025
0fedde9
Add scalarization for vector ops (fallback when SIMD isn't available)
QuantumSegfault Oct 10, 2025
e8281c9
Enable regbankselect to choose f32/f64 for ambiguous instructions (e.…
QuantumSegfault Oct 11, 2025
b742791
Ensure GlobalISel is actually linked in
QuantumSegfault Oct 11, 2025
c480319
Lower GISel bulk memory ops
QuantumSegfault Dec 4, 2025
044f667
Reformat
QuantumSegfault Jan 14, 2026
300571b
Fix lowering of calls into weak aliases to become `call_indirect`
QuantumSegfault Jan 14, 2026
b96eae5
Add `G_USUBSAT` and `G_USUBO` lowering (legalization)
QuantumSegfault Jan 15, 2026
c30bfe4
More fixes for calls into aliases
QuantumSegfault Jan 15, 2026
13edde2
Add RegBankSelect support for `DBG_VALUE`
QuantumSegfault Jan 20, 2026
b04c7d5
Prepare RegBankSelect for intrinsics, and add error for
QuantumSegfault Jan 20, 2026
da2b07d
Cleanup and adjust FCMP legalization
QuantumSegfault Jan 20, 2026
75f2abe
Gate floating-point -> integer conversions behind `nontrapping-fptoint`.
QuantumSegfault Jan 20, 2026
5a48d56
Fix duplicate post-isel pass issue when disabling GlobalISel abort.
QuantumSegfault Jan 20, 2026
a2a1c28
Clean up and adjust FCMP lowerings.
QuantumSegfault Jan 26, 2026
28b44a2
Implement vararg related instructions.
QuantumSegfault Jan 26, 2026
d9b5d36
Fix crash trying to reconstrain registers.
QuantumSegfault Jan 26, 2026
d0a6079
Fix legalization and regbankselect of G_FSHL and G_FSHR
QuantumSegfault Jan 26, 2026
237b169
Implement G_PTR_MASK
QuantumSegfault Jan 26, 2026
f530d69
Fix flag propogation for G_PTR_ADD from getelementptr in IRTranslator
QuantumSegfault Jan 26, 2026
d22f0f0
Modify `selectAddrOperands` to use an adaption of FastISel
QuantumSegfault Jan 26, 2026
f70f2e3
Incorporate `Localizer` pass.
QuantumSegfault Jan 26, 2026
6e4e760
Add some post-legalize combiners (truncstore, fold_global_offset)
QuantumSegfault Jan 26, 2026
d878ac7
Fix `selectAddrOperands` for PIC
QuantumSegfault Jan 27, 2026
0aa0de8
Mark the `G_PTR_ADD`s used to store varargs onto the stack during
QuantumSegfault Jan 29, 2026
3d73f82
Legalize extending `G_LOAD` into `G_ZEXTLOAD` instead.
QuantumSegfault Jan 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//===----------------------------------------------------------------------===//

#include "llvm/CodeGen/GlobalISel/IRTranslator.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
Expand Down Expand Up @@ -64,6 +65,7 @@
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Statepoint.h"
#include "llvm/IR/Type.h"
Expand Down Expand Up @@ -1600,8 +1602,16 @@ bool IRTranslator::translateGetElementPtr(const User &U,
uint32_t PtrAddFlags = 0;
// Each PtrAdd generated to implement the GEP inherits its nuw, nusw, inbounds
// flags.
if (const Instruction *I = dyn_cast<Instruction>(&U))
PtrAddFlags = MachineInstr::copyFlagsFromInstruction(*I);
if (const GEPOperator *GEP = dyn_cast<GEPOperator>(&U)) {
if (GEP->hasNoUnsignedSignedWrap())
PtrAddFlags |= MachineInstr::MIFlag::NoUSWrap;

if (GEP->hasNoUnsignedWrap())
PtrAddFlags |= MachineInstr::MIFlag::NoUWrap;

if (GEP->isInBounds())
PtrAddFlags |= MachineInstr::MIFlag::InBounds;
}

auto PtrAddFlagsWithConst = [&](int64_t Offset) {
// For nusw/inbounds GEP with an offset that is nonnegative when interpreted
Expand Down Expand Up @@ -1706,6 +1716,7 @@ bool IRTranslator::translateGetElementPtr(const User &U,
}

if (Offset != 0) {
Offset = APInt(OffsetTy.getSizeInBits(), Offset, true, true).getSExtValue();
auto OffsetMIB =
MIRBuilder.buildConstant(OffsetTy, Offset);

Expand Down
18 changes: 18 additions & 0 deletions llvm/lib/Target/WebAssembly/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,30 @@ tablegen(LLVM WebAssemblyGenDisassemblerTables.inc -gen-disassembler)
tablegen(LLVM WebAssemblyGenFastISel.inc -gen-fast-isel)
tablegen(LLVM WebAssemblyGenInstrInfo.inc -gen-instr-info)
tablegen(LLVM WebAssemblyGenMCCodeEmitter.inc -gen-emitter)
tablegen(LLVM WebAssemblyGenRegisterBank.inc -gen-register-bank)
tablegen(LLVM WebAssemblyGenRegisterInfo.inc -gen-register-info)
tablegen(LLVM WebAssemblyGenSDNodeInfo.inc -gen-sd-node-info)
tablegen(LLVM WebAssemblyGenSubtargetInfo.inc -gen-subtarget)

set(LLVM_TARGET_DEFINITIONS WebAssemblyGISel.td)
tablegen(LLVM WebAssemblyGenGlobalISel.inc -gen-global-isel)
tablegen(LLVM WebAssemblyGenO0PreLegalizeGICombiner.inc -gen-global-isel-combiner
-combiners="WebAssemblyO0PreLegalizerCombiner")
tablegen(LLVM WebAssemblyGenPreLegalizeGICombiner.inc -gen-global-isel-combiner
-combiners="WebAssemblyPreLegalizerCombiner")
tablegen(LLVM WebAssemblyGenPostLegalizeGICombiner.inc -gen-global-isel-combiner
-combiners="WebAssemblyPostLegalizerCombiner")

add_public_tablegen_target(WebAssemblyCommonTableGen)

add_llvm_target(WebAssemblyCodeGen
GISel/WebAssemblyCallLowering.cpp
GISel/WebAssemblyInstructionSelector.cpp
GISel/WebAssemblyO0PreLegalizerCombiner.cpp
GISel/WebAssemblyPostLegalizerCombiner.cpp
GISel/WebAssemblyPreLegalizerCombiner.cpp
GISel/WebAssemblyLegalizerInfo.cpp
GISel/WebAssemblyRegisterBankInfo.cpp
WebAssemblyAddMissingPrototypes.cpp
WebAssemblyArgumentMove.cpp
WebAssemblyAsmPrinter.cpp
Expand Down Expand Up @@ -72,6 +89,7 @@ add_llvm_target(WebAssemblyCodeGen
CodeGen
CodeGenTypes
Core
GlobalISel
MC
Scalar
SelectionDAG
Expand Down
Loading