Files
TheRock/compiler/amd-llvm/llvm/utils/TableGen/Common/CodeGenInstAlias.h
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

109 lines
3.2 KiB
C++

//===- CodeGenInstAlias.h - InstAlias Class Wrapper -------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines a wrapper class for the 'InstAlias' TableGen class.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_UTILS_TABLEGEN_COMMON_CODEGENINSTALIAS_H
#define LLVM_UTILS_TABLEGEN_COMMON_CODEGENINSTALIAS_H
#include "llvm/ADT/StringRef.h"
#include <cassert>
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
namespace llvm {
class CodeGenInstruction;
class CodeGenTarget;
class DagInit;
class Record;
/// CodeGenInstAlias - This represents an InstAlias definition.
class CodeGenInstAlias {
public:
const Record *TheDef; // The actual record defining this InstAlias.
/// AsmString - The format string used to emit a .s file for the
/// instruction.
std::string AsmString;
/// Result - The result instruction.
const DagInit *Result;
/// ResultInst - The instruction generated by the alias (decoded from
/// Result).
const CodeGenInstruction *ResultInst;
class ResultOperand {
std::string Name;
const Record *R = nullptr;
int64_t Imm = 0;
ResultOperand(std::string N, const Record *R)
: Name(std::move(N)), R(R), Kind(K_Record) {}
ResultOperand(int64_t Imm) : Imm(Imm), Kind(K_Imm) {}
ResultOperand(const Record *R) : R(R), Kind(K_Reg) {}
public:
enum { K_Record, K_Imm, K_Reg } Kind;
static ResultOperand createRecord(std::string N, const Record *R) {
return ResultOperand(std::move(N), R);
}
static ResultOperand createImmediate(int64_t Imm) {
return ResultOperand(Imm);
}
static ResultOperand createRegister(const Record *R) {
return ResultOperand(R);
}
bool isRecord() const { return Kind == K_Record; }
bool isImm() const { return Kind == K_Imm; }
bool isReg() const { return Kind == K_Reg; }
StringRef getName() const {
assert(isRecord());
return Name;
}
const Record *getRecord() const {
assert(isRecord());
return R;
}
int64_t getImm() const {
assert(isImm());
return Imm;
}
const Record *getRegister() const {
assert(isReg());
return R;
}
unsigned getMINumOperands() const;
};
/// ResultOperands - The decoded operands for the result instruction.
std::vector<ResultOperand> ResultOperands;
/// ResultInstOperandIndex - For each operand, this vector holds a pair of
/// indices to identify the corresponding operand in the result
/// instruction. The first index specifies the operand and the second
/// index specifies the suboperand. If there are no suboperands or if all
/// of them are matched by the operand, the second value should be -1.
std::vector<std::pair<unsigned, int>> ResultInstOperandIndex;
CodeGenInstAlias(const Record *R, const CodeGenTarget &T);
};
} // namespace llvm
#endif // LLVM_UTILS_TABLEGEN_COMMON_CODEGENINSTALIAS_H