[all-commits] [llvm/llvm-project] 301758: [X86][MC][NFC] Reduce the parameters of functions ...

KanRobert via All-commits all-commits at lists.llvm.org
Thu Apr 16 22:32:53 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3017580c7961397f96e9481abf82bbf874bb2633
      https://github.com/llvm/llvm-project/commit/3017580c7961397f96e9481abf82bbf874bb2633
  Author: Shengchen Kan <shengchen.kan at intel.com>
  Date:   2020-04-17 (Fri, 17 Apr 2020)

  Changed paths:
    M llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp

  Log Message:
  -----------
  [X86][MC][NFC] Reduce the parameters of functions in X86MCCodeEmitter(Part II)

Summary:
We determine the REX prefix used by instruction in `determineREXPrefix`,
and this value is used in `emitMemModRMByte' and used as the return
value of `emitOpcodePrefix`.

Before this patch, REX was passed as reference to `emitPrefixImpl`, it
is strange and not necessary, e.g, we have to write
```
bool Rex = false;
emitPrefixImpl(CurOp, CurByte, Rex, MI, STI, OS);
```
in `emitPrefix` even if `Rex` will not be used.

So we let HasREX be the return value of `emitPrefixImpl`. The HasREX is passed
from `emitREXPrefix` to  `emitOpcodePrefix` and then to
`emitPrefixImpl`. This makes sense since REX is a kind of opcode prefix
and of course is a prefix.

Reviewers: craig.topper, pengfei

Reviewed By: craig.topper

Subscribers: annita.zhang, craig.topper, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78276




More information about the All-commits mailing list