Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 1 | //===-- IA64PCInstrBuilder.h - Aids for building IA64 insts -----*- C++ -*-===// |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 2 | // |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by Duraid Madina and is distributed under the |
| 6 | // University of Illinois Open Source License. See LICENSE.TXT for details. |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 7 | // |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file exposes functions that may be used with BuildMI from the |
| 11 | // MachineInstrBuilder.h file to simplify generating frame and constant pool |
| 12 | // references. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef IA64_INSTRBUILDER_H |
| 17 | #define IA64_INSTRBUILDER_H |
| 18 | |
| 19 | #include "llvm/CodeGen/MachineInstrBuilder.h" |
| 20 | |
| 21 | namespace llvm { |
| 22 | |
| 23 | /// addFrameReference - This function is used to add a reference to the base of |
| 24 | /// an abstract object on the stack frame of the current function. This |
| 25 | /// reference has base register as the FrameIndex offset until it is resolved. |
| 26 | /// This allows a constant offset to be specified as well... |
| 27 | /// |
| 28 | inline const MachineInstrBuilder& |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 29 | addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0, |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 30 | bool mem = true) { |
| 31 | if (mem) |
Chris Lattner | 63b3d71 | 2006-05-04 17:21:20 +0000 | [diff] [blame] | 32 | return MIB.addImm(Offset).addFrameIndex(FI); |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 33 | else |
Chris Lattner | 63b3d71 | 2006-05-04 17:21:20 +0000 | [diff] [blame] | 34 | return MIB.addFrameIndex(FI).addImm(Offset); |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | /// addConstantPoolReference - This function is used to add a reference to the |
| 38 | /// base of a constant value spilled to the per-function constant pool. The |
| 39 | /// reference has base register ConstantPoolIndex offset which is retained until |
| 40 | /// either machine code emission or assembly output. This allows an optional |
| 41 | /// offset to be added as well. |
| 42 | /// |
| 43 | inline const MachineInstrBuilder& |
| 44 | addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI, |
| 45 | int Offset = 0) { |
Chris Lattner | 63b3d71 | 2006-05-04 17:21:20 +0000 | [diff] [blame] | 46 | return MIB.addImm(Offset).addConstantPoolIndex(CPI); |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | } // End llvm namespace |
| 50 | |
| 51 | #endif |
| 52 | |