xref: /freebsd/contrib/llvm-project/llvm/lib/Target/VE/VEInstrBuilder.h (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
1*e8d8bef9SDimitry Andric //===-- VEInstrBuilder.h - Aides for building VE insts ----------*- C++ -*-===//
2*e8d8bef9SDimitry Andric //
3*e8d8bef9SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*e8d8bef9SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*e8d8bef9SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*e8d8bef9SDimitry Andric //
7*e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===//
8*e8d8bef9SDimitry Andric //
9*e8d8bef9SDimitry Andric // This file exposes functions that may be used with BuildMI from the
10*e8d8bef9SDimitry Andric // MachineInstrBuilder.h file to simplify generating frame and constant pool
11*e8d8bef9SDimitry Andric // references.
12*e8d8bef9SDimitry Andric //
13*e8d8bef9SDimitry Andric // For reference, the order of operands for memory references is:
14*e8d8bef9SDimitry Andric // (Operand), Dest Reg, Base Reg, and either Reg Index or Immediate
15*e8d8bef9SDimitry Andric // Displacement.
16*e8d8bef9SDimitry Andric //
17*e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===//
18*e8d8bef9SDimitry Andric 
19*e8d8bef9SDimitry Andric #ifndef LLVM_LIB_TARGET_VE_VEINSTRBUILDER_H
20*e8d8bef9SDimitry Andric #define LLVM_LIB_TARGET_VE_VEINSTRBUILDER_H
21*e8d8bef9SDimitry Andric 
22*e8d8bef9SDimitry Andric #include "llvm/CodeGen/MachineInstrBuilder.h"
23*e8d8bef9SDimitry Andric 
24*e8d8bef9SDimitry Andric namespace llvm {
25*e8d8bef9SDimitry Andric 
26*e8d8bef9SDimitry Andric /// addFrameReference - This function is used to add a reference to the base of
27*e8d8bef9SDimitry Andric /// an abstract object on the stack frame of the current function.  This
28*e8d8bef9SDimitry Andric /// reference has base register as the FrameIndex offset until it is resolved.
29*e8d8bef9SDimitry Andric /// This allows a constant offset to be specified as well...
30*e8d8bef9SDimitry Andric ///
31*e8d8bef9SDimitry Andric static inline const MachineInstrBuilder &
32*e8d8bef9SDimitry Andric addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0,
33*e8d8bef9SDimitry Andric                   bool ThreeOp = true) {
34*e8d8bef9SDimitry Andric   if (ThreeOp)
35*e8d8bef9SDimitry Andric     return MIB.addFrameIndex(FI).addImm(0).addImm(Offset);
36*e8d8bef9SDimitry Andric   return MIB.addFrameIndex(FI).addImm(Offset);
37*e8d8bef9SDimitry Andric }
38*e8d8bef9SDimitry Andric 
39*e8d8bef9SDimitry Andric } // namespace llvm
40*e8d8bef9SDimitry Andric 
41*e8d8bef9SDimitry Andric #endif
42