-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[RyuJit/WASM] Reach the NYI in genFnProlog
#121863
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
18e17b1
1875211
95576a4
b70996e
bdaac88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,9 +59,110 @@ void CodeGen::genFuncletEpilog() | |
| NYI_WASM("genFuncletEpilog"); | ||
| } | ||
|
|
||
| void CodeGen::genCodeForTreeNode(GenTree* node) | ||
| void CodeGen::genCodeForTreeNode(GenTree* treeNode) | ||
| { | ||
| NYI_WASM("genCodeForTreeNode"); | ||
| #ifdef DEBUG | ||
| lastConsumedNode = nullptr; | ||
| if (compiler->verbose) | ||
| { | ||
| compiler->gtDispLIRNode(treeNode, "Generating: "); | ||
| } | ||
| #endif // DEBUG | ||
|
|
||
| assert(!treeNode->IsReuseRegVal()); // TODO-WASM-CQ: enable. | ||
|
|
||
| // Contained nodes are part of the parent for codegen purposes. | ||
| if (treeNode->isContained()) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| switch (treeNode->OperGet()) | ||
| { | ||
| case GT_ADD: | ||
| genCodeForBinary(treeNode->AsOp()); | ||
| break; | ||
|
|
||
| case GT_LCL_VAR: | ||
| genCodeForLclVar(treeNode->AsLclVar()); | ||
| break; | ||
|
|
||
| case GT_RETURN: | ||
| genReturn(treeNode); | ||
| break; | ||
|
|
||
| case GT_IL_OFFSET: | ||
| // Do nothing; this node is a marker for debug info. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would we eventually want to do something with this node once we start generating DWARF debug info? |
||
| break; | ||
|
|
||
| default: | ||
| #ifdef DEBUG | ||
| NYIRAW(GenTree::OpName(treeNode->OperGet())); | ||
| #else | ||
| NYI_WASM("Opcode not implemented"); | ||
| #endif | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------ | ||
| // genCodeForBinary: Generate code for a binary arithmetic operator | ||
| // | ||
| // Arguments: | ||
| // treeNode - The binary operation for which we are generating code. | ||
| // | ||
| void CodeGen::genCodeForBinary(GenTreeOp* treeNode) | ||
| { | ||
| genConsumeOperands(treeNode); | ||
|
|
||
| instruction ins; | ||
| switch (treeNode->OperGet()) | ||
| { | ||
| case GT_ADD: | ||
| if (!treeNode->TypeIs(TYP_INT)) | ||
| { | ||
| NYI_WASM("genCodeForBinary: non-INT GT_ADD"); | ||
| } | ||
| ins = INS_i32_add; | ||
| break; | ||
| default: | ||
| ins = INS_none; | ||
| NYI_WASM("genCodeForBinary"); | ||
| break; | ||
| } | ||
|
|
||
| GetEmitter()->emitIns(ins); | ||
| genProduceReg(treeNode); | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------ | ||
| // genCodeForLclVar: Produce code for a GT_LCL_VAR node. | ||
| // | ||
| // Arguments: | ||
| // tree - the GT_LCL_VAR node | ||
| // | ||
| void CodeGen::genCodeForLclVar(GenTreeLclVar* tree) | ||
| { | ||
| assert(tree->OperIs(GT_LCL_VAR) && !tree->IsMultiReg()); | ||
| LclVarDsc* varDsc = compiler->lvaGetDesc(tree); | ||
|
|
||
| // Unlike other targets, we can't "reload at the point of use", since that would require inserting instructions | ||
| // into the middle of an already-emitted instruction group. Instead, we order the nodes in a way that obeys the | ||
| // value stack constraints of WASM precisely. However, the liveness tracking is done in the same way as for other | ||
| // targets, hence "genProduceReg" is only called for non-candidates. | ||
| if (!varDsc->lvIsRegCandidate()) | ||
| { | ||
| var_types type = varDsc->GetRegisterType(tree); | ||
| // TODO-WASM: actually local.get the frame base local here. | ||
| GetEmitter()->emitIns_S(ins_Load(type), emitTypeSize(tree), tree->GetLclNum(), 0); | ||
| genProduceReg(tree); | ||
|
Comment on lines
+157
to
+158
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would have expected to see an emit with a memarg here, am I misunderstanding what this does? |
||
| } | ||
| else | ||
| { | ||
| assert(genIsValidReg(varDsc->GetRegNum())); | ||
| unsigned wasmLclIndex = UnpackWasmReg(varDsc->GetRegNum()); | ||
| GetEmitter()->emitIns_I(INS_local_get, emitTypeSize(tree), wasmLclIndex); | ||
| } | ||
| } | ||
|
|
||
| BasicBlock* CodeGen::genCallFinally(BasicBlock* block) | ||
|
|
@@ -76,13 +177,23 @@ void CodeGen::genEHCatchRet(BasicBlock* block) | |
| NYI_WASM("genEHCatchRet"); | ||
| } | ||
|
|
||
| void CodeGen::genStructReturn(GenTree* treeNode) | ||
| { | ||
| NYI_WASM("genStructReturn"); | ||
| } | ||
|
|
||
| void CodeGen::genEmitGSCookieCheck(bool tailCall) | ||
| { | ||
| // TODO-WASM: GS cookie checks have limited utility on WASM since they can only help | ||
| // with detecting linear memory stack corruption. Decide if we want them anyway. | ||
| NYI_WASM("genEmitGSCookieCheck"); | ||
| } | ||
|
|
||
| void CodeGen::genProfilingLeaveCallback(unsigned helper) | ||
| { | ||
| NYI_WASM("genProfilingLeaveCallback"); | ||
| } | ||
|
|
||
| void CodeGen::genSpillVar(GenTree* tree) | ||
| { | ||
| NYI_WASM("Put all spillng to memory under '#if HAS_FIXED_REGISTER_SET'"); | ||
|
|
@@ -159,11 +270,6 @@ void CodeGenInterface::genUpdateVarReg(LclVarDsc* varDsc, GenTree* tree, int reg | |
| NYI_WASM("Move genUpdateVarReg from codegenlinear.cpp to codegencommon.cpp shared code"); | ||
| } | ||
|
|
||
| void CodeGenInterface::genUpdateVarReg(LclVarDsc* varDsc, GenTree* tree) | ||
| { | ||
| NYI_WASM("Move genUpdateVarReg from codegenlinear.cpp to codegencommon.cpp shared code"); | ||
| } | ||
|
|
||
| void RegSet::verifyRegUsed(regNumber reg) | ||
| { | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future is it possible for this sort of thing to be table-driven, by looking up the AsOp() value in a table optimistically? Or do you think we'll need a big switch?