//===-- MachineFunction.cpp -----------------------------------------------===//
//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
// Collect native machine code information for a function. This allows
// target-specific information about the generated code to be stored with each
// function.
#include "llvm/Function.h"
#include "llvm/iOther.h"
#include "llvm/Pass.h"
-#include <limits.h>
+#include "Config/limits.h"
const int INVALID_FRAME_OFFSET = INT_MAX; // std::numeric_limits<int>::max();
};
}
-Pass *createMachineCodeConstructionPass(TargetMachine &Target) {
+FunctionPass *createMachineCodeConstructionPass(TargetMachine &Target) {
return new ConstructMachineFunction(Target);
}
-Pass *createMachineCodeDestructionPass() {
+FunctionPass *createMachineCodeDestructionPass() {
return new DestroyMachineFunction();
}
-Pass *createMachineFunctionPrinterPass() {
+FunctionPass *createMachineFunctionPrinterPass() {
return new Printer();
}
<< "\"\n";
// Print Frame Information
- getFrameInfo()->print(OS);
+ getFrameInfo()->print(*this, OS);
// Print Constant Pool
getConstantPool()->print(OS);
for (const_iterator BB = begin(); BB != end(); ++BB) {
- BasicBlock *LBB = BB->getBasicBlock();
+ const BasicBlock *LBB = BB->getBasicBlock();
OS << "\n" << LBB->getName() << " (" << (const void*)LBB << "):\n";
for (MachineBasicBlock::const_iterator I = BB->begin(); I != BB->end();++I){
OS << "\t";
}
-void MachineFrameInfo::print(std::ostream &OS) const {
+void MachineFrameInfo::print(const MachineFunction &MF, std::ostream &OS) const{
+ int ValOffset = MF.getTarget().getFrameInfo().getOffsetOfLocalArea();
+
for (unsigned i = 0, e = Objects.size(); i != e; ++i) {
const StackObject &SO = Objects[i];
OS << " <fi #" << (int)(i-NumFixedObjects) << "> is ";
if (i < NumFixedObjects)
OS << " fixed";
if (i < NumFixedObjects || SO.SPOffset != -1) {
+ int Off = SO.SPOffset + ValOffset;
OS << " at location [SP";
- if (SO.SPOffset > 0)
- OS << "+" << SO.SPOffset;
- else if (SO.SPOffset < 0)
- OS << SO.SPOffset;
+ if (Off > 0)
+ OS << "+" << Off;
+ else if (Off < 0)
+ OS << Off;
OS << "]";
}
OS << "\n";
OS << " Stack frame contains variable sized objects\n";
}
-void MachineFrameInfo::dump() const { print(std::cerr); }
+void MachineFrameInfo::dump(const MachineFunction &MF) const {
+ print(MF, std::cerr);
+}
//===----------------------------------------------------------------------===//
for (Function::const_iterator BB = F->begin(), BBE = F->end(); BB !=BBE; ++BB)
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
- if (const CallInst *callInst = dyn_cast<CallInst>(&*I))
+ if (const CallInst *callInst = dyn_cast<CallInst>(I))
{
unsigned numOperands = callInst->getNumOperands() - 1;
int numExtra = (int)numOperands-frameInfo.getNumFixedOutgoingArgs();