From de93bb065db7910b0e7aed0935a265abc82eab7c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 21 Sep 2010 05:39:30 +0000 Subject: add some helpful accessors. llvm-svn: 114400 --- llvm/lib/CodeGen/MachineInstr.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index a953597c7e4..acab289953d 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -335,6 +335,14 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const { // MachineMemOperand Implementation //===----------------------------------------------------------------------===// +/// getAddrSpace - Return the LLVM IR address space number that this pointer +/// points into. +unsigned MachinePointerInfo::getAddrSpace() const { + if (V == 0) return 0; + return cast(V->getType())->getAddressSpace(); +} + + MachineMemOperand::MachineMemOperand(MachinePointerInfo ptrinfo, unsigned f, uint64_t s, unsigned int a) : PtrInfo(ptrinfo), Size(s), -- cgit v1.2.3