1 //===--------------------- CodeEmitter.cpp ----------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file implements the CodeEmitter API.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/MCA/CodeEmitter.h"
18 CodeEmitter::EncodingInfo
19 CodeEmitter::getOrCreateEncodingInfo(unsigned MCID
) {
20 EncodingInfo
&EI
= Encodings
[MCID
];
24 SmallVector
<llvm::MCFixup
, 2> Fixups
;
25 const MCInst
&Inst
= Sequence
[MCID
];
26 MCInst
Relaxed(Sequence
[MCID
]);
27 if (MAB
.mayNeedRelaxation(Inst
, STI
))
28 MAB
.relaxInstruction(Inst
, STI
, Relaxed
);
30 EI
.first
= Code
.size();
31 MCE
.encodeInstruction(Relaxed
, VecOS
, Fixups
, STI
);
32 EI
.second
= Code
.size() - EI
.first
;