Path: blob/main/contrib/llvm-project/llvm/lib/MCA/CodeEmitter.cpp
35259 views
//===--------------------- CodeEmitter.cpp ----------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file implements the CodeEmitter API.9//10//===----------------------------------------------------------------------===//1112#include "llvm/MCA/CodeEmitter.h"1314namespace llvm {15namespace mca {1617CodeEmitter::EncodingInfo CodeEmitter::getOrCreateEncodingInfo(unsigned MCID) {18EncodingInfo &EI = Encodings[MCID];19if (EI.second)20return EI;2122SmallVector<llvm::MCFixup, 2> Fixups;23const MCInst &Inst = Sequence[MCID];24MCInst Relaxed(Sequence[MCID]);25if (MAB.mayNeedRelaxation(Inst, STI))26MAB.relaxInstruction(Relaxed, STI);2728EI.first = Code.size();29MCE.encodeInstruction(Relaxed, Code, Fixups, STI);30EI.second = Code.size() - EI.first;31return EI;32}3334} // namespace mca35} // namespace llvm363738