Skip to content
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

Add support for 4-arg ops in mini IR #48908

Closed
wants to merge 1 commit into from

Conversation

fanyang-mono
Copy link
Member

Fixes #48475


struct MonoInst {
guint16 opcode;
guint8 type; /* stack type */
guint8 flags;

/* used by the register allocator */
gint32 dreg, sreg1, sreg2, sreg3;
gint32 dreg, sreg1, sreg2, sreg3, sreg4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a fair bit of discussion about this when I looked into it, and I thought the conclusion was that we didn't want to add them this way since it's only an immediate value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a lot of overhead for the tiny minority of opcodes which have 4 opcodes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's 4 bytes of padding between sreg3 and next on 64-bit machines.

Copy link
Contributor

@CoffeeFlux CoffeeFlux Mar 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still run on a (sadly) 32-bit platform – wasm – so I don't think we can assume this doesn't add overhead on platforms we care about.

Which is not to say we can't take this approach, just that it shouldn't be predicated on incorrect assumptions.

@@ -717,15 +717,15 @@ typedef struct {
LLVMArgInfo args [1];
} LLVMCallInfo;

#define MONO_MAX_SRC_REGS 3
#define MONO_MAX_SRC_REGS 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is actually not enough and the 3 value is hard-coded in a few different places instead of just using this define.

Copy link
Member Author

@fanyang-mono fanyang-mono Mar 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is far away from being completed. I just did the most basic change. Will fix the errors exposed by testing.

@imhameed
Copy link
Contributor

imhameed commented Mar 2, 2021

Current consensus is 'too much churn/work for minimal gain'. #48475 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[mono] Support 4-arg ops in mini IR
5 participants