[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment
[llvm-core.git] / include / llvm / MC / MCInstrInfo.h
blob874b1e46795b1e4c911b93a924c7ef186982ada0
1 //===-- llvm/MC/MCInstrInfo.h - Target Instruction Info ---------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file describes the target machine instruction set.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_MC_MCINSTRINFO_H
14 #define LLVM_MC_MCINSTRINFO_H
16 #include "llvm/MC/MCInstrDesc.h"
17 #include <cassert>
19 namespace llvm {
21 //---------------------------------------------------------------------------
22 /// Interface to description of machine instruction set.
23 class MCInstrInfo {
24 const MCInstrDesc *Desc; // Raw array to allow static init'n
25 const unsigned *InstrNameIndices; // Array for name indices in InstrNameData
26 const char *InstrNameData; // Instruction name string pool
27 unsigned NumOpcodes; // Number of entries in the desc array
29 public:
30 /// Initialize MCInstrInfo, called by TableGen auto-generated routines.
31 /// *DO NOT USE*.
32 void InitMCInstrInfo(const MCInstrDesc *D, const unsigned *NI, const char *ND,
33 unsigned NO) {
34 Desc = D;
35 InstrNameIndices = NI;
36 InstrNameData = ND;
37 NumOpcodes = NO;
40 unsigned getNumOpcodes() const { return NumOpcodes; }
42 /// Return the machine instruction descriptor that corresponds to the
43 /// specified instruction opcode.
44 const MCInstrDesc &get(unsigned Opcode) const {
45 assert(Opcode < NumOpcodes && "Invalid opcode!");
46 return Desc[Opcode];
49 /// Returns the name for the instructions with the given opcode.
50 StringRef getName(unsigned Opcode) const {
51 assert(Opcode < NumOpcodes && "Invalid opcode!");
52 return StringRef(&InstrNameData[InstrNameIndices[Opcode]]);
56 } // End llvm namespace
58 #endif