blob: 719d28a0a85766ecd376941c81fe73087dc9cab2 [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;
Chris Lattnerd4baf0f2004-02-01 05:25:07 +000038 const std::string Banner;
Brian Gaeke09caa372004-01-30 21:53:46 +000039
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
Alkis Evlogimenosc81efdc2004-02-15 00:03:15 +000065namespace {
66 struct Deleter : public MachineFunctionPass {
67 const char *getPassName() const { return "Machine Code Deleter"; }
68
69 bool runOnMachineFunction(MachineFunction &MF) {
70 // Delete the annotation from the function now.
71 MachineFunction::destruct(MF.getFunction());
72 return true;
73 }
74 };
75}
76
77/// MachineCodeDeletion Pass - This pass deletes all of the machine code for
78/// the current function, which should happen after the function has been
79/// emitted to a .s file or to memory.
80FunctionPass *llvm::createMachineCodeDeleter() {
81 return new Deleter();
82}
83
84
85
Chris Lattner227c3d32002-10-28 01:12:41 +000086//===---------------------------------------------------------------------===//
87// MachineFunction implementation
88//===---------------------------------------------------------------------===//
89
Chris Lattner10491642002-10-30 00:48:05 +000090MachineFunction::MachineFunction(const Function *F,
Chris Lattner955fad12002-12-28 20:37:16 +000091 const TargetMachine &TM)
92 : Annotation(MF_AID), Fn(F), Target(TM) {
Misha Brukmanb7825bc2002-11-20 18:55:27 +000093 SSARegMapping = new SSARegMap();
Chris Lattner955fad12002-12-28 20:37:16 +000094 MFInfo = new MachineFunctionInfo(*this);
Chris Lattnereb24db92002-12-28 21:08:26 +000095 FrameInfo = new MachineFrameInfo();
Chris Lattner4d149cd2003-01-13 00:23:03 +000096 ConstantPool = new MachineConstantPool();
Chris Lattner831fdcf2002-12-25 05:03:22 +000097}
98
99MachineFunction::~MachineFunction() {
100 delete SSARegMapping;
Chris Lattner955fad12002-12-28 20:37:16 +0000101 delete MFInfo;
102 delete FrameInfo;
Chris Lattner4d149cd2003-01-13 00:23:03 +0000103 delete ConstantPool;
Chris Lattner10491642002-10-30 00:48:05 +0000104}
105
106void MachineFunction::dump() const { print(std::cerr); }
107
108void MachineFunction::print(std::ostream &OS) const {
Chris Lattner955fad12002-12-28 20:37:16 +0000109 OS << "\n" << *(Value*)Fn->getFunctionType() << " \"" << Fn->getName()
110 << "\"\n";
111
112 // Print Frame Information
Chris Lattner9085d8a2003-01-16 18:35:57 +0000113 getFrameInfo()->print(*this, OS);
Chris Lattner4d149cd2003-01-13 00:23:03 +0000114
115 // Print Constant Pool
116 getConstantPool()->print(OS);
Chris Lattner10491642002-10-30 00:48:05 +0000117
Brian Gaeke90421cd2004-02-13 04:39:55 +0000118 for (const_iterator BB = begin(); BB != end(); ++BB)
119 BB->print(OS);
Chris Lattner10491642002-10-30 00:48:05 +0000120 OS << "\nEnd function \"" << Fn->getName() << "\"\n\n";
121}
122
Brian Gaeke90421cd2004-02-13 04:39:55 +0000123void MachineBasicBlock::dump() const { print(std::cerr); }
124
125void MachineBasicBlock::print(std::ostream &OS) const {
126 const BasicBlock *LBB = getBasicBlock();
127 OS << "\n" << LBB->getName() << " (" << (const void*)LBB << "):\n";
128 for (const_iterator I = begin(); I != end(); ++I) {
129 OS << "\t";
130 I->print(OS, MachineFunction::get(LBB->getParent()).getTarget());
131 }
132}
Chris Lattner10491642002-10-30 00:48:05 +0000133
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000134// The next two methods are used to construct and to retrieve
Chris Lattner2fbfdcf2002-04-07 20:49:59 +0000135// the MachineCodeForFunction object for the given function.
136// construct() -- Allocates and initializes for a given function and target
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000137// get() -- Returns a handle to the object.
138// This should not be called before "construct()"
Chris Lattner2fbfdcf2002-04-07 20:49:59 +0000139// for a given Function.
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000140//
Misha Brukmanfce11432002-10-28 00:28:31 +0000141MachineFunction&
Chris Lattner335d5c32002-10-28 05:58:46 +0000142MachineFunction::construct(const Function *Fn, const TargetMachine &Tar)
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000143{
Chris Lattnere316efc2002-10-29 23:18:43 +0000144 assert(Fn->getAnnotation(MF_AID) == 0 &&
Chris Lattner2fbfdcf2002-04-07 20:49:59 +0000145 "Object already exists for this function!");
Chris Lattner335d5c32002-10-28 05:58:46 +0000146 MachineFunction* mcInfo = new MachineFunction(Fn, Tar);
147 Fn->addAnnotation(mcInfo);
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000148 return *mcInfo;
149}
150
Chris Lattner16c45e92003-12-20 10:20:58 +0000151void MachineFunction::destruct(const Function *Fn) {
Chris Lattnere316efc2002-10-29 23:18:43 +0000152 bool Deleted = Fn->deleteAnnotation(MF_AID);
Chris Lattner2fbfdcf2002-04-07 20:49:59 +0000153 assert(Deleted && "Machine code did not exist for function!");
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000154}
155
Chris Lattner335d5c32002-10-28 05:58:46 +0000156MachineFunction& MachineFunction::get(const Function *F)
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000157{
Chris Lattnere316efc2002-10-29 23:18:43 +0000158 MachineFunction *mc = (MachineFunction*)F->getAnnotation(MF_AID);
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000159 assert(mc && "Call construct() method first to allocate the object");
160 return *mc;
161}
162
Chris Lattner831fdcf2002-12-25 05:03:22 +0000163void MachineFunction::clearSSARegMap() {
164 delete SSARegMapping;
165 SSARegMapping = 0;
166}
167
Chris Lattner955fad12002-12-28 20:37:16 +0000168//===----------------------------------------------------------------------===//
Chris Lattnereb24db92002-12-28 21:08:26 +0000169// MachineFrameInfo implementation
Chris Lattner955fad12002-12-28 20:37:16 +0000170//===----------------------------------------------------------------------===//
171
Chris Lattner4d149cd2003-01-13 00:23:03 +0000172/// CreateStackObject - Create a stack object for a value of the specified type.
173///
174int MachineFrameInfo::CreateStackObject(const Type *Ty, const TargetData &TD) {
175 return CreateStackObject(TD.getTypeSize(Ty), TD.getTypeAlignment(Ty));
176}
177
178int MachineFrameInfo::CreateStackObject(const TargetRegisterClass *RC) {
179 return CreateStackObject(RC->getSize(), RC->getAlignment());
180}
181
182
Chris Lattner9085d8a2003-01-16 18:35:57 +0000183void MachineFrameInfo::print(const MachineFunction &MF, std::ostream &OS) const{
184 int ValOffset = MF.getTarget().getFrameInfo().getOffsetOfLocalArea();
185
Chris Lattner955fad12002-12-28 20:37:16 +0000186 for (unsigned i = 0, e = Objects.size(); i != e; ++i) {
187 const StackObject &SO = Objects[i];
Chris Lattner4d149cd2003-01-13 00:23:03 +0000188 OS << " <fi #" << (int)(i-NumFixedObjects) << "> is ";
Chris Lattner955fad12002-12-28 20:37:16 +0000189 if (SO.Size == 0)
190 OS << "variable sized";
191 else
192 OS << SO.Size << " byte" << (SO.Size != 1 ? "s" : " ");
193
194 if (i < NumFixedObjects)
195 OS << " fixed";
196 if (i < NumFixedObjects || SO.SPOffset != -1) {
Chris Lattner9085d8a2003-01-16 18:35:57 +0000197 int Off = SO.SPOffset + ValOffset;
Chris Lattner955fad12002-12-28 20:37:16 +0000198 OS << " at location [SP";
Chris Lattner9085d8a2003-01-16 18:35:57 +0000199 if (Off > 0)
200 OS << "+" << Off;
201 else if (Off < 0)
202 OS << Off;
Chris Lattner955fad12002-12-28 20:37:16 +0000203 OS << "]";
204 }
205 OS << "\n";
206 }
207
208 if (HasVarSizedObjects)
209 OS << " Stack frame contains variable sized objects\n";
210}
211
Chris Lattner9085d8a2003-01-16 18:35:57 +0000212void MachineFrameInfo::dump(const MachineFunction &MF) const {
213 print(MF, std::cerr);
214}
Chris Lattner955fad12002-12-28 20:37:16 +0000215
216
217//===----------------------------------------------------------------------===//
Chris Lattner4d149cd2003-01-13 00:23:03 +0000218// MachineConstantPool implementation
219//===----------------------------------------------------------------------===//
220
221void MachineConstantPool::print(std::ostream &OS) const {
222 for (unsigned i = 0, e = Constants.size(); i != e; ++i)
223 OS << " <cp #" << i << "> is" << *(Value*)Constants[i] << "\n";
224}
225
226void MachineConstantPool::dump() const { print(std::cerr); }
227
228//===----------------------------------------------------------------------===//
Chris Lattner955fad12002-12-28 20:37:16 +0000229// MachineFunctionInfo implementation
230//===----------------------------------------------------------------------===//
Chris Lattner831fdcf2002-12-25 05:03:22 +0000231
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000232static unsigned
Vikram S. Adve03d33bd2002-04-25 04:30:43 +0000233ComputeMaxOptionalArgsSize(const TargetMachine& target, const Function *F,
234 unsigned &maxOptionalNumArgs)
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000235{
Chris Lattner955fad12002-12-28 20:37:16 +0000236 const TargetFrameInfo &frameInfo = target.getFrameInfo();
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000237
Chris Lattner0b12b5f2002-06-25 16:13:21 +0000238 unsigned maxSize = 0;
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000239
Chris Lattner0b12b5f2002-06-25 16:13:21 +0000240 for (Function::const_iterator BB = F->begin(), BBE = F->end(); BB !=BBE; ++BB)
241 for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
Chris Lattner2ee82e02003-04-23 16:36:11 +0000242 if (const CallInst *callInst = dyn_cast<CallInst>(I))
Chris Lattner0b12b5f2002-06-25 16:13:21 +0000243 {
244 unsigned numOperands = callInst->getNumOperands() - 1;
245 int numExtra = (int)numOperands-frameInfo.getNumFixedOutgoingArgs();
246 if (numExtra <= 0)
247 continue;
248
Chris Lattner955fad12002-12-28 20:37:16 +0000249 unsigned sizeForThisCall;
Chris Lattner0b12b5f2002-06-25 16:13:21 +0000250 if (frameInfo.argsOnStackHaveFixedSize())
251 {
252 int argSize = frameInfo.getSizeOfEachArgOnStack();
253 sizeForThisCall = numExtra * (unsigned) argSize;
254 }
255 else
256 {
257 assert(0 && "UNTESTED CODE: Size per stack argument is not "
258 "fixed on this architecture: use actual arg sizes to "
259 "compute MaxOptionalArgsSize");
260 sizeForThisCall = 0;
261 for (unsigned i = 0; i < numOperands; ++i)
Chris Lattner955fad12002-12-28 20:37:16 +0000262 sizeForThisCall += target.getTargetData().getTypeSize(callInst->
Chris Lattner0b12b5f2002-06-25 16:13:21 +0000263 getOperand(i)->getType());
264 }
265
266 if (maxSize < sizeForThisCall)
267 maxSize = sizeForThisCall;
268
269 if ((int)maxOptionalNumArgs < numExtra)
270 maxOptionalNumArgs = (unsigned) numExtra;
271 }
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000272
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000273 return maxSize;
274}
275
276// Align data larger than one L1 cache line on L1 cache line boundaries.
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000277// Align all smaller data on the next higher 2^x boundary (4, 8, ...),
278// but not higher than the alignment of the largest type we support
279// (currently a double word). -- see class TargetData).
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000280//
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000281// This function is similar to the corresponding function in EmitAssembly.cpp
282// but they are unrelated. This one does not align at more than a
283// double-word boundary whereas that one might.
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000284//
Chris Lattner955fad12002-12-28 20:37:16 +0000285inline unsigned
286SizeToAlignment(unsigned size, const TargetMachine& target)
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000287{
288 unsigned short cacheLineSize = target.getCacheInfo().getCacheLineSize(1);
289 if (size > (unsigned) cacheLineSize / 2)
290 return cacheLineSize;
291 else
292 for (unsigned sz=1; /*no condition*/; sz *= 2)
Chris Lattner955fad12002-12-28 20:37:16 +0000293 if (sz >= size || sz >= target.getTargetData().getDoubleAlignment())
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000294 return sz;
295}
296
297
Chris Lattner955fad12002-12-28 20:37:16 +0000298void MachineFunctionInfo::CalculateArgSize() {
299 maxOptionalArgsSize = ComputeMaxOptionalArgsSize(MF.getTarget(),
300 MF.getFunction(),
Vikram S. Adve03d33bd2002-04-25 04:30:43 +0000301 maxOptionalNumArgs);
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000302 staticStackSize = maxOptionalArgsSize
Chris Lattner955fad12002-12-28 20:37:16 +0000303 + MF.getTarget().getFrameInfo().getMinStackFrameSize();
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000304}
305
306int
Chris Lattner955fad12002-12-28 20:37:16 +0000307MachineFunctionInfo::computeOffsetforLocalVar(const Value* val,
308 unsigned &getPaddedSize,
309 unsigned sizeToUse)
Vikram S. Adve89e2da02002-03-18 03:36:30 +0000310{
Vikram S. Advee4e4d4e2002-03-24 03:39:26 +0000311 if (sizeToUse == 0)
Chris Lattner955fad12002-12-28 20:37:16 +0000312 sizeToUse = MF.getTarget().findOptimalStorageSize(val->getType());
313 unsigned align = SizeToAlignment(sizeToUse, MF.getTarget());
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000314
315 bool growUp;
Chris Lattner955fad12002-12-28 20:37:16 +0000316 int firstOffset = MF.getTarget().getFrameInfo().getFirstAutomaticVarOffset(MF,
317 growUp);
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000318 int offset = growUp? firstOffset + getAutomaticVarsSize()
319 : firstOffset - (getAutomaticVarsSize() + sizeToUse);
320
Chris Lattner955fad12002-12-28 20:37:16 +0000321 int aligned = MF.getTarget().getFrameInfo().adjustAlignment(offset, growUp, align);
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000322 getPaddedSize = sizeToUse + abs(aligned - offset);
323
324 return aligned;
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000325}
326
Chris Lattner07f32d42003-12-20 09:17:07 +0000327
328int MachineFunctionInfo::allocateLocalVar(const Value* val,
329 unsigned sizeToUse) {
Vikram S. Adve03d33bd2002-04-25 04:30:43 +0000330 assert(! automaticVarsAreaFrozen &&
331 "Size of auto vars area has been used to compute an offset so "
332 "no more automatic vars should be allocated!");
333
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000334 // Check if we've allocated a stack slot for this value already
335 //
Chris Lattner07f32d42003-12-20 09:17:07 +0000336 hash_map<const Value*, int>::const_iterator pair = offsets.find(val);
337 if (pair != offsets.end())
338 return pair->second;
339
340 unsigned getPaddedSize;
341 unsigned offset = computeOffsetforLocalVar(val, getPaddedSize, sizeToUse);
342 offsets[val] = offset;
343 incrementAutomaticVarsSize(getPaddedSize);
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000344 return offset;
345}
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000346
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000347int
Chris Lattner955fad12002-12-28 20:37:16 +0000348MachineFunctionInfo::allocateSpilledValue(const Type* type)
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000349{
Vikram S. Adve03d33bd2002-04-25 04:30:43 +0000350 assert(! spillsAreaFrozen &&
351 "Size of reg spills area has been used to compute an offset so "
352 "no more register spill slots should be allocated!");
353
Chris Lattner955fad12002-12-28 20:37:16 +0000354 unsigned size = MF.getTarget().getTargetData().getTypeSize(type);
355 unsigned char align = MF.getTarget().getTargetData().getTypeAlignment(type);
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000356
357 bool growUp;
Chris Lattner955fad12002-12-28 20:37:16 +0000358 int firstOffset = MF.getTarget().getFrameInfo().getRegSpillAreaOffset(MF, growUp);
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000359
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000360 int offset = growUp? firstOffset + getRegSpillsSize()
361 : firstOffset - (getRegSpillsSize() + size);
362
Chris Lattner955fad12002-12-28 20:37:16 +0000363 int aligned = MF.getTarget().getFrameInfo().adjustAlignment(offset, growUp, align);
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000364 size += abs(aligned - offset); // include alignment padding in size
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000365
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000366 incrementRegSpillsSize(size); // update size of reg. spills area
367
368 return aligned;
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000369}
370
371int
Chris Lattner955fad12002-12-28 20:37:16 +0000372MachineFunctionInfo::pushTempValue(unsigned size)
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000373{
Chris Lattner955fad12002-12-28 20:37:16 +0000374 unsigned align = SizeToAlignment(size, MF.getTarget());
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000375
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000376 bool growUp;
Chris Lattner955fad12002-12-28 20:37:16 +0000377 int firstOffset = MF.getTarget().getFrameInfo().getTmpAreaOffset(MF, growUp);
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000378
379 int offset = growUp? firstOffset + currentTmpValuesSize
380 : firstOffset - (currentTmpValuesSize + size);
381
Chris Lattner955fad12002-12-28 20:37:16 +0000382 int aligned = MF.getTarget().getFrameInfo().adjustAlignment(offset, growUp,
383 align);
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000384 size += abs(aligned - offset); // include alignment padding in size
385
386 incrementTmpAreaSize(size); // update "current" size of tmp area
387
388 return aligned;
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000389}
390
Chris Lattner955fad12002-12-28 20:37:16 +0000391void MachineFunctionInfo::popAllTempValues() {
Vikram S. Adve1318bed2002-09-16 15:18:16 +0000392 resetTmpAreaSize(); // clear tmp area to reuse
Chris Lattnerf2868ce2002-02-03 07:54:50 +0000393}
394