mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
Change to allow iMemory.h to avoid including DerivedTypes.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2403 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -9,7 +9,7 @@
|
|||||||
#define LLVM_IMEMORY_H
|
#define LLVM_IMEMORY_H
|
||||||
|
|
||||||
#include "llvm/Instruction.h"
|
#include "llvm/Instruction.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
class PointerType;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// AllocationInst Class
|
// AllocationInst Class
|
||||||
@ -42,9 +42,8 @@ public:
|
|||||||
|
|
||||||
// getAllocatedType - Return the type that is being allocated by the
|
// getAllocatedType - Return the type that is being allocated by the
|
||||||
// instruction.
|
// instruction.
|
||||||
inline const Type *getAllocatedType() const {
|
//
|
||||||
return getType()->getElementType();
|
const Type *getAllocatedType() const;
|
||||||
}
|
|
||||||
|
|
||||||
virtual Instruction *clone() const = 0;
|
virtual Instruction *clone() const = 0;
|
||||||
|
|
||||||
@ -64,13 +63,12 @@ public:
|
|||||||
// MallocInst Class
|
// MallocInst Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
class MallocInst : public AllocationInst {
|
struct MallocInst : public AllocationInst {
|
||||||
public:
|
|
||||||
MallocInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "")
|
MallocInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "")
|
||||||
: AllocationInst(Ty, ArraySize, Malloc, Name) {}
|
: AllocationInst(Ty, ArraySize, Malloc, Name) {}
|
||||||
|
|
||||||
virtual Instruction *clone() const {
|
virtual Instruction *clone() const {
|
||||||
return new MallocInst(getType(), (Value*)Operands[0].get());
|
return new MallocInst((Type*)getType(), (Value*)Operands[0].get());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char *getOpcodeName() const { return "malloc"; }
|
virtual const char *getOpcodeName() const { return "malloc"; }
|
||||||
@ -90,13 +88,12 @@ public:
|
|||||||
// AllocaInst Class
|
// AllocaInst Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
class AllocaInst : public AllocationInst {
|
struct AllocaInst : public AllocationInst {
|
||||||
public:
|
|
||||||
AllocaInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "")
|
AllocaInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "")
|
||||||
: AllocationInst(Ty, ArraySize, Alloca, Name) {}
|
: AllocationInst(Ty, ArraySize, Alloca, Name) {}
|
||||||
|
|
||||||
virtual Instruction *clone() const {
|
virtual Instruction *clone() const {
|
||||||
return new AllocaInst(getType(), (Value*)Operands[0].get());
|
return new AllocaInst((Type*)getType(), (Value*)Operands[0].get());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char *getOpcodeName() const { return "alloca"; }
|
virtual const char *getOpcodeName() const { return "alloca"; }
|
||||||
@ -116,13 +113,8 @@ public:
|
|||||||
// FreeInst Class
|
// FreeInst Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
class FreeInst : public Instruction {
|
struct FreeInst : public Instruction {
|
||||||
public:
|
FreeInst(Value *Ptr);
|
||||||
FreeInst(Value *Ptr) : Instruction(Type::VoidTy, Free, "") {
|
|
||||||
assert(Ptr->getType()->isPointerType() && "Can't free nonpointer!");
|
|
||||||
Operands.reserve(1);
|
|
||||||
Operands.push_back(Use(Ptr, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual Instruction *clone() const { return new FreeInst(Operands[0]); }
|
virtual Instruction *clone() const { return new FreeInst(Operands[0]); }
|
||||||
|
|
||||||
@ -270,7 +262,7 @@ public:
|
|||||||
|
|
||||||
class GetElementPtrInst : public MemAccessInst {
|
class GetElementPtrInst : public MemAccessInst {
|
||||||
GetElementPtrInst(const GetElementPtrInst &EPI)
|
GetElementPtrInst(const GetElementPtrInst &EPI)
|
||||||
: MemAccessInst(EPI.getType(), GetElementPtr) {
|
: MemAccessInst((Type*)EPI.getType(), GetElementPtr) {
|
||||||
Operands.reserve(EPI.Operands.size());
|
Operands.reserve(EPI.Operands.size());
|
||||||
for (unsigned i = 0, E = EPI.Operands.size(); i != E; ++i)
|
for (unsigned i = 0, E = EPI.Operands.size(); i != E; ++i)
|
||||||
Operands.push_back(Use(EPI.Operands[i], this));
|
Operands.push_back(Use(EPI.Operands[i], this));
|
||||||
@ -284,7 +276,7 @@ public:
|
|||||||
|
|
||||||
// getType - Overload to return most specific pointer type...
|
// getType - Overload to return most specific pointer type...
|
||||||
inline const PointerType *getType() const {
|
inline const PointerType *getType() const {
|
||||||
return cast<const PointerType>(Instruction::getType());
|
return (PointerType*)Instruction::getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
|
Reference in New Issue
Block a user