LLVM API Documentation

IA64InstrBuilder.h

Go to the documentation of this file.
00001 //===-- IA64PCInstrBuilder.h - Aids for building IA64 insts -----*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by Duraid Madina and is distributed under the
00006 // University of Illinois Open Source License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file exposes functions that may be used with BuildMI from the
00011 // MachineInstrBuilder.h file to simplify generating frame and constant pool
00012 // references.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 
00016 #ifndef IA64_INSTRBUILDER_H
00017 #define IA64_INSTRBUILDER_H
00018 
00019 #include "llvm/CodeGen/MachineInstrBuilder.h"
00020 
00021 namespace llvm {
00022 
00023 /// addFrameReference - This function is used to add a reference to the base of
00024 /// an abstract object on the stack frame of the current function.  This
00025 /// reference has base register as the FrameIndex offset until it is resolved.
00026 /// This allows a constant offset to be specified as well...
00027 ///
00028 inline const MachineInstrBuilder&
00029 addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0,
00030                   bool mem = true) {
00031   if (mem)
00032     return MIB.addSImm(Offset).addFrameIndex(FI);
00033   else
00034     return MIB.addFrameIndex(FI).addSImm(Offset);
00035 }
00036 
00037 /// addConstantPoolReference - This function is used to add a reference to the
00038 /// base of a constant value spilled to the per-function constant pool.  The
00039 /// reference has base register ConstantPoolIndex offset which is retained until
00040 /// either machine code emission or assembly output.  This allows an optional
00041 /// offset to be added as well.
00042 ///
00043 inline const MachineInstrBuilder&
00044 addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
00045                          int Offset = 0) {
00046   return MIB.addSImm(Offset).addConstantPoolIndex(CPI);
00047 }
00048 
00049 } // End llvm namespace
00050 
00051 #endif
00052