//===-- llvm/Instructions.h - Instruction subclass definitions --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file exposes the class definitions of all of the subclasses of the
// Instruction class. This is meant to be an easy way to get access to all
// instruction subclasses.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_INSTRUCTIONS_H
#define LLVM_INSTRUCTIONS_H
#include "llvm/Instruction.h"
#include "llvm/InstrTypes.h"
namespace llvm {
class BasicBlock;
class ConstantInt;
class PointerType;
//===----------------------------------------------------------------------===//
// AllocationInst Class
//===----------------------------------------------------------------------===//
/// AllocationInst - This class is the common base class of MallocInst and
/// AllocaInst.
///
class AllocationInst : public UnaryInstruction {
unsigned Alignment;
protected:
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align,
const std::string &Name = "", Instruction *InsertBefore = 0);
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align,
const std::string &Name, BasicBlock *InsertAtEnd);
public:
/// isArrayAllocation - Return true if there is an allocation size parameter
/// to the allocation instruction that is not 1.
///
bool isArrayAllocation() const;
/// getArraySize - Get the number of element allocated, for a simple
/// allocation of a single element, this will return a constant 1 value.
///
inline const Value *getArraySize() const { return getOperand(0); }
inline Value *getArraySize() { return getOperand(0); }
/// getType - Overload to return most specific pointer type
///
inline const PointerType *getType() const {
return reinterpret_cast<const PointerType*>(Instruction