blob: 51b3744312ed56398f8c4da22c25c0e2c1b80fff [file] [log] [blame]
Duraid Madina9b9d45f2005-03-17 18:17:03 +00001//===-- IA64PCInstrBuilder.h - Aids for building IA64 insts -----*- C++ -*-===//
Misha Brukman4633f1c2005-04-21 23:13:11 +00002//
Duraid Madina9b9d45f2005-03-17 18:17:03 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukman4633f1c2005-04-21 23:13:11 +00007//
Duraid Madina9b9d45f2005-03-17 18:17:03 +00008//===----------------------------------------------------------------------===//
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
21namespace 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///
28inline const MachineInstrBuilder&
Misha Brukman4633f1c2005-04-21 23:13:11 +000029addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0,
Duraid Madina9b9d45f2005-03-17 18:17:03 +000030 bool mem = true) {
31 if (mem)
Chris Lattner63b3d712006-05-04 17:21:20 +000032 return MIB.addImm(Offset).addFrameIndex(FI);
Duraid Madina9b9d45f2005-03-17 18:17:03 +000033 else
Chris Lattner63b3d712006-05-04 17:21:20 +000034 return MIB.addFrameIndex(FI).addImm(Offset);
Duraid Madina9b9d45f2005-03-17 18:17:03 +000035}
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///
43inline const MachineInstrBuilder&
44addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
45 int Offset = 0) {
Chris Lattner63b3d712006-05-04 17:21:20 +000046 return MIB.addImm(Offset).addConstantPoolIndex(CPI);
Duraid Madina9b9d45f2005-03-17 18:17:03 +000047}
48
49} // End llvm namespace
50
51#endif
52