blob: bb23d389bdf6100a4825635352508bc8d51f79cb [file] [log] [blame]
Alex Bradbury22c091f2018-11-15 10:11:31 +00001//===- RISCVMatInt.h - Immediate materialisation ---------------*- C++ -*--===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Alex Bradbury22c091f2018-11-15 10:11:31 +00006//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_TARGET_RISCV_MATINT_H
10#define LLVM_LIB_TARGET_RISCV_MATINT_H
11
12#include "llvm/ADT/SmallVector.h"
13#include "llvm/Support/MachineValueType.h"
14#include <cstdint>
15
16namespace llvm {
17
18namespace RISCVMatInt {
19struct Inst {
20 unsigned Opc;
21 int64_t Imm;
22
23 Inst(unsigned Opc, int64_t Imm) : Opc(Opc), Imm(Imm) {}
24};
25using InstSeq = SmallVector<Inst, 8>;
26
27// Helper to generate an instruction sequence that will materialise the given
28// immediate value into a register. A sequence of instructions represented by
29// a simple struct produced rather than directly emitting the instructions in
30// order to allow this helper to be used from both the MC layer and during
31// instruction selection.
32void generateInstSeq(int64_t Val, bool IsRV64, InstSeq &Res);
33} // namespace RISCVMatInt
34} // namespace llvm
35#endif