-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Copy link
Labels
arch-wasmWebAssembly architectureWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
The WebAssembly RyuJIT backend in codegenwasm.cpp and emitwasm.cpp needs to be updated as follows:
- Add a definition for
CodeGen::genSetRegToConstwhich switches ontree->gtOper()and has cases forGT_CNS_INTandGT_CNS_DBL. The case forGT_CNS_INTshould useAsIntCon()->IconValue()to store the integer constant into assize_t constant. The case forGT_CNS_DBLshould useAsDblCon()->DconValue()to store the double constant into adouble constant. - Declare a new member function in
emitwasm.hcalledemitEncodeLEB64with the signaturesize_t emitter:emitEncodeLEB64(uint8_t *destination, const void *source, bool valueIsSigned). - Define
emitEncodeLeb64inemitwasm.cppand make its body aNYI_WASM. - Declare a new member function in
emitwasm.hcalledemitIns_R_Fwith the signaturevoid emitter::emitIns_R_F(instruction ins, emitAttr attr, regNumber reg, double immDbl). - Define
emitIns_R_Finemitwasm.cppand make its body aNYI_WASM. - Update
genSetRegToConst'sGT_CNS_INTcase to useemitEncodeLEB64to measure the size of the integer constant like so:emitAttr encodedSize = (emitAttr)GetEmitter()->emitEncodeLEB64(nullptr, &constant, true); - Update
genSetRegToConst'sGT_CNS_DBLcase to determine the size of the floating-point constant based on targetType, like so:emitAttr encodedSize = (targetType == TYP_FLOAT) ? EA_4BYTE : EA_8BYTE; - Update
genSetRegToConst'sGT_CNS_INTcase to callemitIns_R_Iwith appropriate arguments, like so:GetEmitter()->emitIns_R_I((targetType == TYP_INT) ? INS_i32_const : INS_i64_const, encodedSize, targetReg, constant);. - Update
genSetRegToConst'sGT_CNS_DBLcase to callemitIns_R_Fwith appropriate arguments, like so:GetEmitter()->emitIns_R_F((targetType == TYP_FLOAT) ? INS_f32_const : INS_f64_const, encodedSize, targetReg, constant);. - Update
CodeGen::genCodeForTreeNodeto add cases forGT_CNS_INTandGT_CNS_DBLthat call the newgenSetRegToConstmember function. ThetargetRegistreeNode->GetRegNum()and thetargetTypeistreeNode->TypeGet(). After callinggenSetRegToConst, callgenProduceReg(treeNode).
Copilot
Metadata
Metadata
Labels
arch-wasmWebAssembly architectureWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI