mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
start pushing MachinePointerInfo out through the MachineMemOperand interface
to the MachineFunction construction methods. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114390 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -37,6 +37,7 @@ class MCContext;
|
|||||||
class Pass;
|
class Pass;
|
||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
class TargetRegisterClass;
|
class TargetRegisterClass;
|
||||||
|
struct MachinePointerInfo;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ilist_traits<MachineBasicBlock>
|
struct ilist_traits<MachineBasicBlock>
|
||||||
@@ -372,6 +373,13 @@ public:
|
|||||||
int64_t o, uint64_t s,
|
int64_t o, uint64_t s,
|
||||||
unsigned base_alignment);
|
unsigned base_alignment);
|
||||||
|
|
||||||
|
/// getMachineMemOperand - Allocate a new MachineMemOperand.
|
||||||
|
/// MachineMemOperands are owned by the MachineFunction and need not be
|
||||||
|
/// explicitly deallocated.
|
||||||
|
MachineMemOperand *getMachineMemOperand(MachinePointerInfo PtrInfo,
|
||||||
|
unsigned f, uint64_t s,
|
||||||
|
unsigned base_alignment);
|
||||||
|
|
||||||
/// getMachineMemOperand - Allocate a new MachineMemOperand by copying
|
/// getMachineMemOperand - Allocate a new MachineMemOperand by copying
|
||||||
/// an existing one, adjusting by an offset and using the given size.
|
/// an existing one, adjusting by an offset and using the given size.
|
||||||
/// MachineMemOperands are owned by the MachineFunction and need not be
|
/// MachineMemOperands are owned by the MachineFunction and need not be
|
||||||
|
|||||||
@@ -29,8 +29,14 @@ class raw_ostream;
|
|||||||
/// or to virtual locations (such as frame indices) that are exposed during
|
/// or to virtual locations (such as frame indices) that are exposed during
|
||||||
/// codegen.
|
/// codegen.
|
||||||
struct MachinePointerInfo {
|
struct MachinePointerInfo {
|
||||||
|
/// V - This is the IR pointer value for the access, or it is null if unknown.
|
||||||
|
/// If this is null, then the access is to a pointer in the default address
|
||||||
|
/// space.
|
||||||
const Value *V;
|
const Value *V;
|
||||||
|
|
||||||
|
/// Offset - This is an offset from the base Value*.
|
||||||
int64_t Offset;
|
int64_t Offset;
|
||||||
|
|
||||||
MachinePointerInfo(const Value *v, int64_t offset) : V(v), Offset(offset) {}
|
MachinePointerInfo(const Value *v, int64_t offset) : V(v), Offset(offset) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,9 +70,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// MachineMemOperand - Construct an MachineMemOperand object with the
|
/// MachineMemOperand - Construct an MachineMemOperand object with the
|
||||||
/// specified address Value, flags, offset, size, and base alignment.
|
/// specified PtrInfo, flags, size, and base alignment.
|
||||||
MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s,
|
MachineMemOperand(MachinePointerInfo PtrInfo, unsigned flags, uint64_t s,
|
||||||
unsigned int base_alignment);
|
unsigned base_alignment);
|
||||||
|
|
||||||
/// getValue - Return the base address of the memory access. This may either
|
/// getValue - Return the base address of the memory access. This may either
|
||||||
/// be a normal LLVM IR Value, or one of the special values used in CodeGen.
|
/// be a normal LLVM IR Value, or one of the special values used in CodeGen.
|
||||||
|
|||||||
@@ -193,17 +193,23 @@ MachineMemOperand *
|
|||||||
MachineFunction::getMachineMemOperand(const Value *v, unsigned f,
|
MachineFunction::getMachineMemOperand(const Value *v, unsigned f,
|
||||||
int64_t o, uint64_t s,
|
int64_t o, uint64_t s,
|
||||||
unsigned base_alignment) {
|
unsigned base_alignment) {
|
||||||
return new (Allocator) MachineMemOperand(v, f, o, s, base_alignment);
|
return new (Allocator) MachineMemOperand(MachinePointerInfo(v, o), f,
|
||||||
|
s, base_alignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
MachineMemOperand *
|
||||||
|
MachineFunction::getMachineMemOperand(MachinePointerInfo PtrInfo, unsigned f,
|
||||||
|
uint64_t s, unsigned base_alignment) {
|
||||||
|
return new (Allocator) MachineMemOperand(PtrInfo, f, s, base_alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineMemOperand *
|
MachineMemOperand *
|
||||||
MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
|
MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
|
||||||
int64_t Offset, uint64_t Size) {
|
int64_t Offset, uint64_t Size) {
|
||||||
return new (Allocator)
|
return new (Allocator)
|
||||||
MachineMemOperand(MMO->getValue(), MMO->getFlags(),
|
MachineMemOperand(MachinePointerInfo(MMO->getValue(),
|
||||||
int64_t(uint64_t(MMO->getOffset()) +
|
MMO->getOffset()+Offset),
|
||||||
uint64_t(Offset)),
|
MMO->getFlags(), Size, MMO->getBaseAlignment());
|
||||||
Size, MMO->getBaseAlignment());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineInstr::mmo_iterator
|
MachineInstr::mmo_iterator
|
||||||
|
|||||||
@@ -335,11 +335,12 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const {
|
|||||||
// MachineMemOperand Implementation
|
// MachineMemOperand Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
MachineMemOperand::MachineMemOperand(const Value *v, unsigned int f,
|
MachineMemOperand::MachineMemOperand(MachinePointerInfo ptrinfo, unsigned f,
|
||||||
int64_t o, uint64_t s, unsigned int a)
|
uint64_t s, unsigned int a)
|
||||||
: PtrInfo(v, o), Size(s),
|
: PtrInfo(ptrinfo), Size(s),
|
||||||
Flags((f & ((1 << MOMaxBits) - 1)) | ((Log2_32(a) + 1) << MOMaxBits)) {
|
Flags((f & ((1 << MOMaxBits) - 1)) | ((Log2_32(a) + 1) << MOMaxBits)) {
|
||||||
assert((v == 0 || isa<PointerType>(v->getType())) && "invalid pointer value");
|
assert((PtrInfo.V == 0 || isa<PointerType>(PtrInfo.V->getType())) &&
|
||||||
|
"invalid pointer value");
|
||||||
assert(getBaseAlignment() == a && "Alignment is not a power of 2!");
|
assert(getBaseAlignment() == a && "Alignment is not a power of 2!");
|
||||||
assert((isLoad() || isStore()) && "Not a load/store!");
|
assert((isLoad() || isStore()) && "Not a load/store!");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user