From cc80b02834507be2116e4d8d86dd92cf6cbc090a Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Mon, 22 Oct 2001 13:51:33 +0000 Subject: Added class MachineCodeForMethod. llvm-svn: 947 --- llvm/lib/CodeGen/MachineInstr.cpp | 40 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/MachineInstr.cpp') diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 2ec791f..b4f275d 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -176,7 +176,45 @@ operator<<(ostream &os, const MachineOperand &mop) void -PrintMachineInstructions(const Method *const method) +MachineCodeForMethod::putLocalVarAtOffsetFromFP(const Value* local, + int offset, + unsigned int size) +{ + offsetsFromFP[local] = offset; + incrementAutomaticVarsSize(size); +} + + +void +MachineCodeForMethod::putLocalVarAtOffsetFromSP(const Value* local, + int offset, + unsigned int size) +{ + offsetsFromSP[local] = offset; + incrementAutomaticVarsSize(size); +} + + +int +MachineCodeForMethod::getOffsetFromFP(const Value* local) const +{ + hash_map::const_iterator pair = offsetsFromFP.find(local); + assert(pair != offsetsFromFP.end() && "Offset from FP unknown for Value"); + return (*pair).second; +} + + +int +MachineCodeForMethod::getOffsetFromSP(const Value* local) const +{ + hash_map::const_iterator pair = offsetsFromSP.find(local); + assert(pair != offsetsFromSP.end() && "Offset from SP unknown for Value"); + return (*pair).second; +} + + +void +MachineCodeForMethod::dump() const { cout << "\n" << method->getReturnType() << " \"" << method->getName() << "\"" << endl; -- cgit v1.1