This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] ] Add a generic machine opcode for ADD.
ClosedPublic

Authored by qcolombet on Dec 11 2015, 4:38 PM.

Details

Summary

Hi,

The selection process being split into separate passes (will happen soon, right? ;)), we need generic opcodes to translate the LLVM IR to target independent code.

This patch adds an opcode for addition: gADD.

The patch is pretty straight forward, but I still opted for pre-commit review as I want to be sure everyone agrees on the basic naming convention: g<OPCODE>, where g stands for generic.

From this point, the idea is to add the opcode as we need them and also, just add the ones that we think are necessary. Anyhow, we need at least one to start prototyping the IRTranslator.

Cheers,
-Quentin

Diff Detail

Repository
rL LLVM

Event Timeline

qcolombet updated this revision to Diff 42602.Dec 11 2015, 4:38 PM
qcolombet retitled this revision from to [GlobalISel] ] Add a generic machine opcode for ADD..
qcolombet updated this object.
qcolombet added reviewers: echristo, chandlerc, hfinkel.
qcolombet set the repository for this revision to rL LLVM.
MatzeB added a subscriber: MatzeB.Dec 11 2015, 5:01 PM

My vote would go for just 'ADD'. The other generic instruction don't have a prefix either.

I assume the reason for a 'g' prefix are:

  • Make it obvious that the opcode needs to be replaced after GISel: having a verifier check that is enough IMO
  • Differentiating it from target opcodes: This may be a better reason, though so far the targets I looked at had 'r','i',32'... suffixes on their instructions.

Following a discussion with Matthias on IRC, here are a few points why I chose gADD instead of ADD:

  • I want a visual distinction between generic opcode, like COPY, and generic opcode that are used only by GlobalISel. The latter must not occur after the select pass. (Will be enforced by the verifier.)
  • I expect targets to have ADD, SUB, etc. operators and I don’t want to conflict with those names, I also want a clear visual distinction, e.g., gADD vs. ADDrr is better than ADD vs. ADDrr IMO.

Q.

Forgot to put the list in CC!

arsenm added a subscriber: arsenm.Jan 4 2016, 4:19 PM

I would prefer G_ instead of the only lowercase letter for an instruction name

So far we have three proposals for GISel opcodes, all of them got one vote:

  1. g<opcode>, e.g., gADD
  2. <opcode>, e.g., ADD
  3. G_<opcode>, e.g., G_ADD

Which one is your favorite?

I am going to go for #1 if I do not get other vote to break the tie :).

Cheers,
-Quentin

reames added a subscriber: reames.Jan 11 2016, 6:02 PM

Either (1) or (3) would be good. (2) is ambiguous.

Philip

qcolombet updated this revision to Diff 44663.Jan 12 2016, 1:05 PM

Thanks all for the feedbacks.

Renamed accordingly.

Hi,

Ok to commit?

Thanks,
-Quentin

arsenm accepted this revision.Jan 19 2016, 10:04 AM
arsenm added a reviewer: arsenm.

LGTM

This revision is now accepted and ready to land.Jan 19 2016, 10:04 AM
This revision was automatically updated to reflect the committed changes.