| Nate Begeman | 6cca84e | 2005-10-16 05:39:50 +0000 | [diff] [blame] | 1 | //===-- PPCInstrBuilder.h - Aides for building PPC insts --------*- C++ -*-===// | 
| Misha Brukman | b440243 | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 2 | // | 
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 | 
| Misha Brukman | b440243 | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 6 | // | 
| Misha Brukman | e05203f | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 7 | //===----------------------------------------------------------------------===// | 
|  | 8 | // | 
|  | 9 | // This file exposes functions that may be used with BuildMI from the | 
|  | 10 | // MachineInstrBuilder.h file to simplify generating frame and constant pool | 
|  | 11 | // references. | 
|  | 12 | // | 
|  | 13 | // For reference, the order of operands for memory references is: | 
| Misha Brukman | 6ff6551 | 2004-07-07 20:01:36 +0000 | [diff] [blame] | 14 | // (Operand), Dest Reg, Base Reg, and either Reg Index or Immediate | 
|  | 15 | // Displacement. | 
| Misha Brukman | e05203f | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 16 | // | 
|  | 17 | //===----------------------------------------------------------------------===// | 
|  | 18 |  | 
| Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 19 | #ifndef LLVM_LIB_TARGET_POWERPC_PPCINSTRBUILDER_H | 
|  | 20 | #define LLVM_LIB_TARGET_POWERPC_PPCINSTRBUILDER_H | 
| Misha Brukman | e05203f | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 21 |  | 
|  | 22 | #include "llvm/CodeGen/MachineInstrBuilder.h" | 
|  | 23 |  | 
|  | 24 | namespace llvm { | 
|  | 25 |  | 
|  | 26 | /// addFrameReference - This function is used to add a reference to the base of | 
|  | 27 | /// an abstract object on the stack frame of the current function.  This | 
|  | 28 | /// reference has base register as the FrameIndex offset until it is resolved. | 
|  | 29 | /// This allows a constant offset to be specified as well... | 
|  | 30 | /// | 
| Anton Korobeynikov | 12b4b7c | 2009-07-16 14:03:08 +0000 | [diff] [blame] | 31 | static inline const MachineInstrBuilder& | 
| Misha Brukman | b440243 | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 32 | addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0, | 
| Misha Brukman | 6ff6551 | 2004-07-07 20:01:36 +0000 | [diff] [blame] | 33 | bool mem = true) { | 
|  | 34 | if (mem) | 
| Chris Lattner | fef7a2d | 2006-05-04 17:21:20 +0000 | [diff] [blame] | 35 | return MIB.addImm(Offset).addFrameIndex(FI); | 
| Misha Brukman | 6ff6551 | 2004-07-07 20:01:36 +0000 | [diff] [blame] | 36 | else | 
| Chris Lattner | fef7a2d | 2006-05-04 17:21:20 +0000 | [diff] [blame] | 37 | return MIB.addFrameIndex(FI).addImm(Offset); | 
| Misha Brukman | e05203f | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 38 | } | 
|  | 39 |  | 
| Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 40 | } // End llvm namespace | 
| Misha Brukman | e05203f | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 41 |  | 
|  | 42 | #endif |