LLVM API Documentation

PseudoSourceValue.h
Go to the documentation of this file.
00001 //===-- llvm/CodeGen/PseudoSourceValue.h ------------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains the declaration of the PseudoSourceValue class.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
00015 #define LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
00016 
00017 #include "llvm/IR/Value.h"
00018 
00019 namespace llvm {
00020   class MachineFrameInfo;
00021   class raw_ostream;
00022 
00023   /// PseudoSourceValue - Special value supplied for machine level alias
00024   /// analysis. It indicates that a memory access references the functions
00025   /// stack frame (e.g., a spill slot), below the stack frame (e.g., argument
00026   /// space), or constant pool.
00027   class PseudoSourceValue : public Value {
00028   private:
00029     /// printCustom - Implement printing for PseudoSourceValue. This is called
00030     /// from Value::print or Value's operator<<.
00031     ///
00032     virtual void printCustom(raw_ostream &O) const;
00033 
00034   public:
00035     explicit PseudoSourceValue(enum ValueTy Subclass = PseudoSourceValueVal);
00036 
00037     /// isConstant - Test whether the memory pointed to by this
00038     /// PseudoSourceValue has a constant value.
00039     ///
00040     virtual bool isConstant(const MachineFrameInfo *) const;
00041 
00042     /// isAliased - Test whether the memory pointed to by this
00043     /// PseudoSourceValue may also be pointed to by an LLVM IR Value.
00044     virtual bool isAliased(const MachineFrameInfo *) const;
00045 
00046     /// mayAlias - Return true if the memory pointed to by this
00047     /// PseudoSourceValue can ever alias a LLVM IR Value.
00048     virtual bool mayAlias(const MachineFrameInfo *) const;
00049 
00050     /// classof - Methods for support type inquiry through isa, cast, and
00051     /// dyn_cast:
00052     ///
00053     static inline bool classof(const Value *V) {
00054       return V->getValueID() == PseudoSourceValueVal ||
00055              V->getValueID() == FixedStackPseudoSourceValueVal;
00056     }
00057 
00058     /// A pseudo source value referencing a fixed stack frame entry,
00059     /// e.g., a spill slot.
00060     static const PseudoSourceValue *getFixedStack(int FI);
00061 
00062     /// A pseudo source value referencing the area below the stack frame of
00063     /// a function, e.g., the argument space.
00064     static const PseudoSourceValue *getStack();
00065 
00066     /// A pseudo source value referencing the global offset table
00067     /// (or something the like).
00068     static const PseudoSourceValue *getGOT();
00069 
00070     /// A pseudo source value referencing the constant pool. Since constant
00071     /// pools are constant, this doesn't need to identify a specific constant
00072     /// pool entry.
00073     static const PseudoSourceValue *getConstantPool();
00074 
00075     /// A pseudo source value referencing a jump table. Since jump tables are
00076     /// constant, this doesn't need to identify a specific jump table.
00077     static const PseudoSourceValue *getJumpTable();
00078   };
00079 
00080   /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
00081   /// for holding FixedStack values, which must include a frame
00082   /// index.
00083   class FixedStackPseudoSourceValue : public PseudoSourceValue {
00084     const int FI;
00085   public:
00086     explicit FixedStackPseudoSourceValue(int fi) :
00087         PseudoSourceValue(FixedStackPseudoSourceValueVal), FI(fi) {}
00088 
00089     /// classof - Methods for support type inquiry through isa, cast, and
00090     /// dyn_cast:
00091     ///
00092     static inline bool classof(const Value *V) {
00093       return V->getValueID() == FixedStackPseudoSourceValueVal;
00094     }
00095 
00096     virtual bool isConstant(const MachineFrameInfo *MFI) const;
00097 
00098     virtual bool isAliased(const MachineFrameInfo *MFI) const;
00099 
00100     virtual bool mayAlias(const MachineFrameInfo *) const;
00101 
00102     virtual void printCustom(raw_ostream &OS) const;
00103 
00104     int getFrameIndex() const { return FI; }
00105   };
00106 } // End llvm namespace
00107 
00108 #endif