Skip to content

Conversation

@YonahGoldberg
Copy link
Contributor

Lots of updates here.

  • Added an Arm64MacroAssembler to allow for operations that emit multiple assembly instructions. This is useful often in the backend.
  • The Arm64MacroAssembler also has operations that take addresses as operands and handles patching internally.
  • SsaArm64Gen is reworked so that it never calls iN.view on an integer type. I did this initially because Arm64 doesn't support large immediates in instructions, so it was easiest to just "view" the integer as a smaller type. This is dangerous and could cause unexpected bugs later on because views can truncate. SsaArm64Gen now makes the type of integers explicit in the MachIR by using Box. This allows for the MachIR to be closer to a mirror of the emitted assembly.
  • Added a second scratch register for the Arm64 backend. This is explained in a comment in Arm64RegSet.v3.
  • The only time the Arm64 backend calls view on an immediate is when patching addresses, which is a difficult corner case that I'll handle later.
  • Added pretty printing for the Arm64 MachIR, which I'll continue updating as I add more support. This includes a small change to other MachIRs, where immediates always show they're type when printing. Below is an example.
Screenshot 2024-10-02 at 12 48 32 PM

I_BL => {
var target: bool, outgoing: MachCallConv, livepoint = -1;
for (o in a) {
match (o) {
Copy link
Owner

Choose a reason for hiding this comment

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

It seems like BL doesn't really fit under the "none" addressing mode. If you're switching over operands, then it's better to encode that into the addressing mode.

return buf;
}
match (val) {
x: Box<u1> => buf.putd(x.val);
Copy link
Owner

Choose a reason for hiding this comment

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

I've been trying to move the compiler away from using Box<int>, Box<long>, etc, to having dedicated value classes, instead of a parameterized class. I think it'd be less error prone to try to use Box to enforce the bitwidth of immediates. Therefore I think it'd be better to use Box<int> for now for all integer-sized immediates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants