For writing comments like  in cpp, what’s the convention in terms of assembly syntax? Or just follow what the particular cpp file is using?
Didn’t find the answer from a cursory read of this thread ([LLVMdev] Intel vs. AT&T Assembly.), and programmer manual doesn’t mention this.
// Look for the following patterns
// %reg = and %reg1 %reg2
// ... // EFLAGS not changed.
// %extended_reg = subreg_to_reg 0, %reg, %subreg.sub_index
// testrr %extended_reg, %extended_reg, implicit-def $eflags
I looked in the coding standards and didn’t find anything, so it’s probably best to just follow whatever the particular cpp file is using.
thanks! This makes sense.
In hindsight, I think this question is probably most relevant for x86 backend code, but not very relevant for others (say aarch64).
Given the implicit-def I assume that’s in the order that the operands are given in the LLVM instruction definition, whichever way round that is.
To expand a bit on what @jrtc27 said: this syntax looks like the dump that you get from the MC layer, which is neither Intel nor AT&T syntax. For example, this line:
%reg = and %reg1 %reg2
Puts the source on the left, with an equals sign, then the operation, then the arguments. This representation generally contains more information (e.g. explicit definitions, kills of registers) than any assembly language and (purely subjective) I find it much easier to read. It’s more common to see this in comments in the back end than any assembly language that’s designed for humans to write.