blob: e25fe8d5885aa60a0f2cc61928d4e2c06b680390 [file] [log] [blame]
Chris Lattner6b944532002-10-28 01:16:38 +00001//===-- MachineFunction.cpp -----------------------------------------------===//
Chris Lattnerf2868ce2002-02-03 07:54:50 +00002//
John Criswellb576c942003-10-20 19:43:21 +00003// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Chris Lattner6b944532002-10-28 01:16:38 +000010// Collect native machine code information for a function. This allows
11// target-specific information about the generated code to be stored with each
12// function.
13//
14//===----------------------------------------------------------------------===//
Chris Lattnerf2868ce2002-02-03 07:54:50 +000015
Chris Lattner16c45e92003-12-20 10:20:58 +000016#include "llvm/CodeGen/MachineFunctionPass.h"
Chris Lattner831fdcf2002-12-25 05:03:22 +000017#include "llvm/CodeGen/MachineInstr.h"
Chris Lattner227c3d32002-10-28 01:12:41 +000018#include "llvm/CodeGen/MachineCodeForInstruction.h"
Chris Lattner831fdcf2002-12-25 05:03:22 +000019#include "llvm/CodeGen/SSARegMap.h"
Chris Lattner955fad12002-12-28 20:37:16 +000020#include "llvm/CodeGen/MachineFunctionInfo.h"
Chris Lattnereb24db92002-12-28 21:08:26 +000021#include "llvm/CodeGen/MachineFrameInfo.h"
Chris Lattner4d149cd2003-01-13 00:23:03 +000022#include "llvm/CodeGen/MachineConstantPool.h"
Chris Lattner16c45e92003-12-20 10:20:58 +000023#include "llvm/CodeGen/Passes.h"
Chris Lattnerf2868ce2002-02-03 07:54:50 +000024#include "llvm/Target/TargetMachine.h"
Chris Lattner8bd66e62002-12-28 21:00:25 +000025#include "llvm/Target/TargetFrameInfo.h"
Chris Lattnerf27eeea2002-12-29 02:50:35 +000026#include "llvm/Target/TargetCacheInfo.h"
Chris Lattner2fbfdcf2002-04-07 20:49:59 +000027#include "llvm/Function.h"
Chris Lattnerf2868ce2002-02-03 07:54:50 +000028#include "llvm/iOther.h"
Chris Lattner07f32d42003-12-20 09:17:07 +000029using namespace llvm;
Chris Lattnerf2868ce2002-02-03 07:54:50 +000030
Chris Lattnere316efc2002-10-29 23:18:43 +000031static AnnotationID MF_AID(
Chris Lattner2fbfdcf2002-04-07 20:49:59 +000032 AnnotationManager::getID("CodeGen::MachineCodeForFunction"));
Chris Lattnerf2868ce2002-02-03 07:54:50 +000033
Chris Lattner227c3d32002-10-28 01:12:41 +000034
Chris Lattner227c3d32002-10-28 01:12:41 +000035namespace {
Chris Lattner16c45e92003-12-20 10:20:58 +000036 struct Printer : public MachineFunctionPass {
Brian Gaeke09caa372004-01-30 21:53:46 +000037 std::ostream *OS;
38 const std::string &Banner;
39
40 Printer (std::ostream *_OS, const std::string &_Banner) :
41 OS (_OS), Banner (_Banner) { }
42
Chris Lattner10491642002-10-30 00:48:05 +000043 const char *getPassName() const { return "MachineFunction Printer"; }
44
45 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
46 AU.setPreservesAll();
47 }
48
Chris Lattner16c45e92003-12-20 10:20:58 +000049 bool runOnMachineFunction(MachineFunction &MF) {
Brian Gaeke09caa372004-01-30 21:53:46 +000050 (*OS) << Banner;
51 MF.print (*OS);
Chris Lattner10491642002-10-30 00:48:05 +000052 return false;
53 }
54 };
Chris Lattner227c3d32002-10-28 01:12:41 +000055}
56
Brian Gaeke09caa372004-01-30 21:53:46 +000057/// Returns a newly-created MachineFunction Printer pass. The default output
58/// stream is std::cerr; the default banner is empty.
59///
60FunctionPass *llvm::createMachineFunctionPrinterPass(std::ostream *OS,
61 const std::string &Banner) {
62 return new Printer(OS, Banner);
Chris Lattner10491642002-10-30 00:48:05 +000063}
64
Chris Lattner16c45e92003-12-20 10:20:58 +000065namespace {
66 struct Deleter : public MachineFunctionPass {
67 const char *getPassName() const { return "Machine Code Deleter"; }
68
69 bool runOnMachineFunction(MachineFunction &MF) {
70 // Delete all of the MachineInstrs out of the function. When the sparc
71 // backend gets fixed, this can be dramatically simpler, but actually
72 // putting this stuff into the MachineBasicBlock destructor!
73 for (MachineFunction::iterator BB = MF.begin(), E = MF.end(); BB != E;
74 ++BB)
75 while (!BB->empty())
76 delete BB->pop_back();
77
78 // Delete the annotation from the function now.
79 MachineFunction::destruct(MF.getFunction());
80 return true;
81 }
82 };
83}
84
85/// MachineCodeDeletion Pass - This pass deletes all of the machine code for
86/// the current function, which should happen after the function has been
87/// emitted to a .s file or to memory.
88FunctionPass *llvm::createMachineCodeDeleter() {
89 return new Deleter();
90}
91
Chris Lattner227c3d32002-10-28 01:12:41 +000092
93//===---------------------------------------------------------------------===//
94// MachineFunction implementation
95//===---------------------------------------------------------------------===//
96
Chris Lattner10491642002-10-30 00:48:05 +000097MachineFunction::MachineFunction(const Function *F,
Chris Lattner955fad12002-12-28 20:37:16 +000098 const TargetMachine &TM)
99 : Annotation(MF_AID), Fn(F), Target(TM) {
Misha Brukmanb7825bc2002-11-20 18:55:27 +0000100 SSARegMapping = new SSARegMap();
Chris Lattner955fad12002-12-28 20:37:16 +0000101 MFInfo = new MachineFunctionInfo(*this);
Chris Lattnereb24db92002-12-28 21:08:26 +0000102 FrameInfo = new MachineFrameInfo();
Chris Lattner4d149cd2003-01-13 00:23:03 +0000103 ConstantPool = new MachineConstantPool();
Chris Lattner831fdcf2002-12-25 05:03:22 +0000104}
105
106MachineFunction::~MachineFunction() {
107 delete SSARegMapping;
Chris Lattner955fad12002-12-28 20:37:16 +0000108 delete MFInfo;
109 delete FrameInfo;
Chris Lattner4d149cd2003-01-13 00:23:03 +0000110 delete ConstantPool;
Chris Lattner10491642002-10-30 00:48:05 +0000111}
112
113void MachineFunction::dump() const { print(std::cerr); }
114
115void MachineFunction::print(std::ostream &OS) const {
Chris Lattner955fad12002-12-28 20:37:16 +0000116 OS << "\n" << *(Value*)Fn->getFunctionType() << " \"" << Fn->getName()
117 << "\"\n";
118
119 // Print Frame Information
Chris Lattner9085d8a2003-01-16 18:35:57 +0000120 getFrameInfo()->print(*this, OS);
Chris Lattner4d149cd2003-01-13 00:23:03 +0000121
122 // Print Constant Pool
123 getConstantPool()->print(OS);
Chris Lattner10491642002-10-30 00:48:05 +0000124
125 for (const_iterator BB = begin(); BB != end(); ++BB) {
Chris Lattner9e2dd8f2003-07-26 23:24:56 +0000126 const BasicBlock *LBB = BB->getBasicBlock();
Chris Lattner2109f502002-12-15 20:35:25 +0000127 OS << "\n" << LBB->getName() << " (" << (const void*)LBB << "):\n";
Chris Lattner10491642002-10-30 00:48:05 +0000128 for (MachineBasicBlock::const_iterator I = BB->begin(); I != BB->end();++I){
129 OS << "\t";
130 (*I)->print(OS, Target);
131 }
132 }
133 OS << "\nEnd function \"" << Fn->getName() << "\"\n\n";
134}
135
136
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000137// The next two methods are used to construct and to retrieve
Chris Lattner2fbfdcf2002-04-07 20:49:59 +0000138// the MachineCodeForFunction object for the given function.
139// construct() -- Allocates and initializes for a given function and target
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000140// get() -- Returns a handle to the object.
141// This should not be called before "construct()"
Chris Lattner2fbfdcf2002-04-07 20:49:59 +0000142// for a given Function.
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000143//
Misha Brukmanfce11432002-10-28 00:28:31 +0000144MachineFunction&
Chris Lattner335d5c32002-10-28 05:58:46 +0000145MachineFunction::construct(const Function *Fn, const TargetMachine &Tar)
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000146{
Chris Lattnere316efc2002-10-29 23:18:43 +0000147 assert(Fn->getAnnotation(MF_AID) == 0 &&
Chris Lattner2fbfdcf2002-04-07 20:49:59 +0000148 "Object already exists for this function!");
Chris Lattner335d5c32002-10-28 05:58:46 +0000149 MachineFunction* mcInfo = new MachineFunction(Fn, Tar);
150 Fn->addAnnotation(mcInfo);
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000151 return *mcInfo;
152}
153
Chris Lattner16c45e92003-12-20 10:20:58 +0000154void MachineFunction::destruct(const Function *Fn) {
Chris Lattnere316efc2002-10-29 23:18:43 +0000155 bool Deleted = Fn->deleteAnnotation(MF_AID);
Chris Lattner2fbfdcf2002-04-07 20:49:59 +0000156 assert(Deleted && "Machine code did not exist for function!");
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000157}
158
Chris Lattner335d5c32002-10-28 05:58:46 +0000159MachineFunction& MachineFunction::get(const Function *F)
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000160{
Chris Lattnere316efc2002-10-29 23:18:43 +0000161 MachineFunction *mc = (MachineFunction*)F->getAnnotation(MF_AID);
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000162 assert(mc && "Call construct() method first to allocate the object");
163 return *mc;
164}
165
Chris Lattner831fdcf2002-12-25 05:03:22 +0000166void MachineFunction::clearSSARegMap() {
167 delete SSARegMapping;
168 SSARegMapping = 0;
169}
170
Chris Lattner955fad12002-12-28 20:37:16 +0000171//===----------------------------------------------------------------------===//
Chris Lattnereb24db92002-12-28 21:08:26 +0000172// MachineFrameInfo implementation
Chris Lattner955fad12002-12-28 20:37:16 +0000173//===----------------------------------------------------------------------===//
174
Chris Lattner4d149cd2003-01-13 00:23:03 +0000175/// CreateStackObject - Create a stack object for a value of the specified type.
176///
177int MachineFrameInfo::CreateStackObject(const Type *Ty, const TargetData &TD) {
178 return CreateStackObject(TD.getTypeSize(Ty), TD.getTypeAlignment(Ty));
179}
180
181int MachineFrameInfo::CreateStackObject(const TargetRegisterClass *RC) {
182 return CreateStackObject(RC->getSize(), RC->getAlignment());
183}
184
185
Chris Lattner9085d8a2003-01-16 18:35:57 +0000186void MachineFrameInfo::print(const MachineFunction &MF, std::ostream &OS) const{
187 int ValOffset = MF.getTarget().getFrameInfo().getOffsetOfLocalArea();
188
Chris Lattner955fad12002-12-28 20:37:16 +0000189 for (unsigned i = 0, e = Objects.size(); i != e; ++i) {
190 const StackObject &SO = Objects[i];
Chris Lattner4d149cd2003-01-13 00:23:03 +0000191 OS << " <fi #" << (int)(i-NumFixedObjects) << "> is ";
Chris Lattner955fad12002-12-28 20:37:16 +0000192 if (SO.Size == 0)
193 OS << "variable sized";
194 else
195 OS << SO.Size << " byte" << (SO.Size != 1 ? "s" : " ");
196
197 if (i < NumFixedObjects)
198 OS << " fixed";
199 if (i < NumFixedObjects || SO.SPOffset != -1) {
Chris Lattner9085d8a2003-01-16 18:35:57 +0000200 int Off = SO.SPOffset + ValOffset;
Chris Lattner955fad12002-12-28 20:37:16 +0000201 OS << " at location [SP";
Chris Lattner9085d8a2003-01-16 18:35:57 +0000202 if (Off > 0)
203 OS << "+" << Off;
204 else if (Off < 0)
205 OS << Off;
Chris Lattner955fad12002-12-28 20:37:16 +0000206 OS << "]";
207 }
208 OS << "\n";
209 }
210
211 if (HasVarSizedObjects)
212 OS << " Stack frame contains variable sized objects\n";
213}
214
Chris Lattner9085d8a2003-01-16 18:35:57 +0000215void MachineFrameInfo::dump(const MachineFunction &MF) const {
216 print(MF, std::cerr);
217}
Chris Lattner955fad12002-12-28 20:37:16 +0000218
219
220//===----------------------------------------------------------------------===//
Chris Lattner4d149cd2003-01-13 00:23:03 +0000221// MachineConstantPool implementation
222//===----------------------------------------------------------------------===//
223
224void MachineConstantPool::print(std::ostream &OS) const {
225 for (unsigned i = 0, e = Constants.size(); i != e; ++i)
226 OS << " <cp #" << i << "> is" << *(Value*)Constants[i] << "\n";
227}
228
229void MachineConstantPool::dump() const { print(std::cerr); }
230
231//===----------------------------------------------------------------------===//
Chris Lattner955fad12002-12-28 20:37:16 +0000232// MachineFunctionInfo implementation
233//===----------------------------------------------------------------------===//
Chris Lattner831fdcf2002-12-25 05:03:22 +0000234
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000235static unsigned
Vikram S. Adve03d33bd2002-04-25 04:30:43 +0000236ComputeMaxOptionalArgsSize(const TargetMachine& target, const Function *F,
237 unsigned &maxOptionalNumArgs)
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000238{
Chris Lattner955fad12002-12-28 20:37:16 +0000239 const TargetFrameInfo &frameInfo = target.getFrameInfo();
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000240
Chris Lattner0b12b5f2002-06-25 16:13:21 +0000241 unsigned maxSize = 0;
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000242
Chris Lattner0b12b5f2002-06-25 16:13:21 +0000243 for (Function::const_iterator BB = F->begin(), BBE = F->end(); BB !=BBE; ++BB)
244 for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
Chris Lattner2ee82e02003-04-23 16:36:11 +0000245 if (const CallInst *callInst = dyn_cast<CallInst>(I))
Chris Lattner0b12b5f2002-06-25 16:13:21 +0000246 {
247 unsigned numOperands = callInst->getNumOperands() - 1;
248 int numExtra = (int)numOperands-frameInfo.getNumFixedOutgoingArgs();
249 if (numExtra <= 0)
250 continue;
251
Chris Lattner955fad12002-12-28 20:37:16 +0000252 unsigned sizeForThisCall;
Chris Lattner0b12b5f2002-06-25 16:13:21 +0000253 if (frameInfo.argsOnStackHaveFixedSize())
254 {
255 int argSize = frameInfo.getSizeOfEachArgOnStack();
256 sizeForThisCall = numExtra * (unsigned) argSize;
257 }
258 else
259 {
260 assert(0 && "UNTESTED CODE: Size per stack argument is not "
261 "fixed on this architecture: use actual arg sizes to "
262 "compute MaxOptionalArgsSize");
263 sizeForThisCall = 0;
264 for (unsigned i = 0; i < numOperands; ++i)
Chris Lattner955fad12002-12-28 20:37:16 +0000265 sizeForThisCall += target.getTargetData().getTypeSize(callInst->
Chris Lattner0b12b5f2002-06-25 16:13:21 +0000266 getOperand(i)->getType());
267 }
268
269 if (maxSize < sizeForThisCall)
270 maxSize = sizeForThisCall;
271
272 if ((int)maxOptionalNumArgs < numExtra)
273 maxOptionalNumArgs = (unsigned) numExtra;
274 }
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000275
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000276 return maxSize;
277}
278
279// Align data larger than one L1 cache line on L1 cache line boundaries.
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000280// Align all smaller data on the next higher 2^x boundary (4, 8, ...),
281// but not higher than the alignment of the largest type we support
282// (currently a double word). -- see class TargetData).
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000283//
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000284// This function is similar to the corresponding function in EmitAssembly.cpp
285// but they are unrelated. This one does not align at more than a
286// double-word boundary whereas that one might.
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000287//
Chris Lattner955fad12002-12-28 20:37:16 +0000288inline unsigned
289SizeToAlignment(unsigned size, const TargetMachine& target)
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000290{
291 unsigned short cacheLineSize = target.getCacheInfo().getCacheLineSize(1);
292 if (size > (unsigned) cacheLineSize / 2)
293 return cacheLineSize;
294 else
295 for (unsigned sz=1; /*no condition*/; sz *= 2)
Chris Lattner955fad12002-12-28 20:37:16 +0000296 if (sz >= size || sz >= target.getTargetData().getDoubleAlignment())
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000297 return sz;
298}
299
300
Chris Lattner955fad12002-12-28 20:37:16 +0000301void MachineFunctionInfo::CalculateArgSize() {
302 maxOptionalArgsSize = ComputeMaxOptionalArgsSize(MF.getTarget(),
303 MF.getFunction(),
Vikram S. Adve03d33bd2002-04-25 04:30:43 +0000304 maxOptionalNumArgs);
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000305 staticStackSize = maxOptionalArgsSize
Chris Lattner955fad12002-12-28 20:37:16 +0000306 + MF.getTarget().getFrameInfo().getMinStackFrameSize();
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000307}
308
309int
Chris Lattner955fad12002-12-28 20:37:16 +0000310MachineFunctionInfo::computeOffsetforLocalVar(const Value* val,
311 unsigned &getPaddedSize,
312 unsigned sizeToUse)
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000313{
Vikram S. Advee4e4d4e2002-03-24 03:39:26 +0000314 if (sizeToUse == 0)
Chris Lattner955fad12002-12-28 20:37:16 +0000315 sizeToUse = MF.getTarget().findOptimalStorageSize(val->getType());
316 unsigned align = SizeToAlignment(sizeToUse, MF.getTarget());
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000317
318 bool growUp;
Chris Lattner955fad12002-12-28 20:37:16 +0000319 int firstOffset = MF.getTarget().getFrameInfo().getFirstAutomaticVarOffset(MF,
320 growUp);
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000321 int offset = growUp? firstOffset + getAutomaticVarsSize()
322 : firstOffset - (getAutomaticVarsSize() + sizeToUse);
323
Chris Lattner955fad12002-12-28 20:37:16 +0000324 int aligned = MF.getTarget().getFrameInfo().adjustAlignment(offset, growUp, align);
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000325 getPaddedSize = sizeToUse + abs(aligned - offset);
326
327 return aligned;
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000328}
329
Chris Lattner07f32d42003-12-20 09:17:07 +0000330
331int MachineFunctionInfo::allocateLocalVar(const Value* val,
332 unsigned sizeToUse) {
Vikram S. Adve03d33bd2002-04-25 04:30:43 +0000333 assert(! automaticVarsAreaFrozen &&
334 "Size of auto vars area has been used to compute an offset so "
335 "no more automatic vars should be allocated!");
336
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000337 // Check if we've allocated a stack slot for this value already
338 //
Chris Lattner07f32d42003-12-20 09:17:07 +0000339 hash_map<const Value*, int>::const_iterator pair = offsets.find(val);
340 if (pair != offsets.end())
341 return pair->second;
342
343 unsigned getPaddedSize;
344 unsigned offset = computeOffsetforLocalVar(val, getPaddedSize, sizeToUse);
345 offsets[val] = offset;
346 incrementAutomaticVarsSize(getPaddedSize);
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000347 return offset;
348}
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000349
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000350int
Chris Lattner955fad12002-12-28 20:37:16 +0000351MachineFunctionInfo::allocateSpilledValue(const Type* type)
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000352{
Vikram S. Adve03d33bd2002-04-25 04:30:43 +0000353 assert(! spillsAreaFrozen &&
354 "Size of reg spills area has been used to compute an offset so "
355 "no more register spill slots should be allocated!");
356
Chris Lattner955fad12002-12-28 20:37:16 +0000357 unsigned size = MF.getTarget().getTargetData().getTypeSize(type);
358 unsigned char align = MF.getTarget().getTargetData().getTypeAlignment(type);
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000359
360 bool growUp;
Chris Lattner955fad12002-12-28 20:37:16 +0000361 int firstOffset = MF.getTarget().getFrameInfo().getRegSpillAreaOffset(MF, growUp);
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000362
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000363 int offset = growUp? firstOffset + getRegSpillsSize()
364 : firstOffset - (getRegSpillsSize() + size);
365
Chris Lattner955fad12002-12-28 20:37:16 +0000366 int aligned = MF.getTarget().getFrameInfo().adjustAlignment(offset, growUp, align);
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000367 size += abs(aligned - offset); // include alignment padding in size
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000368
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000369 incrementRegSpillsSize(size); // update size of reg. spills area
370
371 return aligned;
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000372}
373
374int
Chris Lattner955fad12002-12-28 20:37:16 +0000375MachineFunctionInfo::pushTempValue(unsigned size)
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000376{
Chris Lattner955fad12002-12-28 20:37:16 +0000377 unsigned align = SizeToAlignment(size, MF.getTarget());
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000378
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000379 bool growUp;
Chris Lattner955fad12002-12-28 20:37:16 +0000380 int firstOffset = MF.getTarget().getFrameInfo().getTmpAreaOffset(MF, growUp);
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000381
382 int offset = growUp? firstOffset + currentTmpValuesSize
383 : firstOffset - (currentTmpValuesSize + size);
384
Chris Lattner955fad12002-12-28 20:37:16 +0000385 int aligned = MF.getTarget().getFrameInfo().adjustAlignment(offset, growUp,
386 align);
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000387 size += abs(aligned - offset); // include alignment padding in size
388
389 incrementTmpAreaSize(size); // update "current" size of tmp area
390
391 return aligned;
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000392}
393
Chris Lattner955fad12002-12-28 20:37:16 +0000394void MachineFunctionInfo::popAllTempValues() {
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000395 resetTmpAreaSize(); // clear tmp area to reuse
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000396}
397