[llvm-commits] [llvm] r114390 - in /llvm/trunk: include/llvm/CodeGen/MachineFunction.h include/llvm/CodeGen/MachineMemOperand.h lib/CodeGen/MachineFunction.cpp lib/CodeGen/MachineInstr.cpp
Chris Lattner
sabre at nondot.org
Mon Sep 20 21:32:08 PDT 2010
Author: lattner
Date: Mon Sep 20 23:32:08 2010
New Revision: 114390
URL: http://llvm.org/viewvc/llvm-project?rev=114390&view=rev
Log:
start pushing MachinePointerInfo out through the MachineMemOperand interface
to the MachineFunction construction methods.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineFunction.h
llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h
llvm/trunk/lib/CodeGen/MachineFunction.cpp
llvm/trunk/lib/CodeGen/MachineInstr.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=114390&r1=114389&r2=114390&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Sep 20 23:32:08 2010
@@ -37,6 +37,7 @@
class Pass;
class TargetMachine;
class TargetRegisterClass;
+struct MachinePointerInfo;
template <>
struct ilist_traits<MachineBasicBlock>
@@ -372,6 +373,13 @@
int64_t o, uint64_t s,
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
/// an existing one, adjusting by an offset and using the given size.
/// MachineMemOperands are owned by the MachineFunction and need not be
Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h?rev=114390&r1=114389&r2=114390&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Mon Sep 20 23:32:08 2010
@@ -29,8 +29,14 @@
/// or to virtual locations (such as frame indices) that are exposed during
/// codegen.
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;
+
+ /// Offset - This is an offset from the base Value*.
int64_t Offset;
+
MachinePointerInfo(const Value *v, int64_t offset) : V(v), Offset(offset) {}
};
@@ -64,9 +70,9 @@
};
/// MachineMemOperand - Construct an MachineMemOperand object with the
- /// specified address Value, flags, offset, size, and base alignment.
- MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s,
- unsigned int base_alignment);
+ /// specified PtrInfo, flags, size, and base alignment.
+ MachineMemOperand(MachinePointerInfo PtrInfo, unsigned flags, uint64_t s,
+ unsigned base_alignment);
/// 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.
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=114390&r1=114389&r2=114390&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Mon Sep 20 23:32:08 2010
@@ -193,17 +193,23 @@
MachineFunction::getMachineMemOperand(const Value *v, unsigned f,
int64_t o, uint64_t s,
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 *
MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
int64_t Offset, uint64_t Size) {
return new (Allocator)
- MachineMemOperand(MMO->getValue(), MMO->getFlags(),
- int64_t(uint64_t(MMO->getOffset()) +
- uint64_t(Offset)),
- Size, MMO->getBaseAlignment());
+ MachineMemOperand(MachinePointerInfo(MMO->getValue(),
+ MMO->getOffset()+Offset),
+ MMO->getFlags(), Size, MMO->getBaseAlignment());
}
MachineInstr::mmo_iterator
Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=114390&r1=114389&r2=114390&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Mon Sep 20 23:32:08 2010
@@ -335,11 +335,12 @@
// MachineMemOperand Implementation
//===----------------------------------------------------------------------===//
-MachineMemOperand::MachineMemOperand(const Value *v, unsigned int f,
- int64_t o, uint64_t s, unsigned int a)
- : PtrInfo(v, o), Size(s),
+MachineMemOperand::MachineMemOperand(MachinePointerInfo ptrinfo, unsigned f,
+ uint64_t s, unsigned int a)
+ : PtrInfo(ptrinfo), Size(s),
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((isLoad() || isStore()) && "Not a load/store!");
}
More information about the llvm-commits
mailing list