llvm.org GIT mirror llvm / 7b3640b
Optional args are no longer allocated as they are discovered. (This can be improved to avoid making the initial pass over the method.) Also, ensure automatic vars and reg. spills areas are not extended if their sizes are used for computing some other offset. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2319 91177308-0d34-0410-b5e6-96231b3b80d8 Vikram S. Adve 18 years ago
2 changed file(s) with 28 addition(s) and 34 deletion(s). Raw diff Collapse all Expand all
2020
2121
2222 class MachineCodeForMethod : private Annotation {
23 const Function* method;
24 bool compiledAsLeaf;
23 std::hash_set constantsForConstPool;
24 std::hash_map offsets;
25 const Function* method;
2526 unsigned staticStackSize;
2627 unsigned automaticVarsSize;
2728 unsigned regSpillsSize;
28 unsigned currentOptionalArgsSize;
2929 unsigned maxOptionalArgsSize;
30 unsigned maxOptionalNumArgs;
3031 unsigned currentTmpValuesSize;
3132 unsigned maxTmpValuesSize;
32 std::hash_set constantsForConstPool;
33 std::hash_map offsets;
33 bool compiledAsLeaf;
34 bool spillsAreaFrozen;
35 bool automaticVarsAreaFrozen;
3436
3537 public:
3638 /*ctor*/ MachineCodeForMethod(const Function* function,
5658 inline unsigned getAutomaticVarsSize() const { return automaticVarsSize; }
5759 inline unsigned getRegSpillsSize() const { return regSpillsSize; }
5860 inline unsigned getMaxOptionalArgsSize() const { return maxOptionalArgsSize;}
59 inline unsigned getCurrentOptionalArgsSize() const
60 { return currentOptionalArgsSize;}
61 inline unsigned getMaxOptionalNumArgs() const { return maxOptionalNumArgs;}
6162 inline const std::hash_set&
6263 getConstantPoolValues() const {return constantsForConstPool;}
6364
7273 inline void markAsLeafMethod() { compiledAsLeaf = true; }
7374
7475 int computeOffsetforLocalVar (const TargetMachine& target,
75 const Value* local,
76 const Value* local,
7677 unsigned int& getPaddedSize,
7778 unsigned int sizeToUse = 0);
78
7979 int allocateLocalVar (const TargetMachine& target,
8080 const Value* local,
8181 unsigned int sizeToUse = 0);
8383 int allocateSpilledValue (const TargetMachine& target,
8484 const Type* type);
8585
86 int allocateOptionalArg (const TargetMachine& target,
87 const Type* type);
88
89 void resetOptionalArgs (const TargetMachine& target);
90
9186 int pushTempValue (const TargetMachine& target,
9287 unsigned int size);
9388
9489 void popAllTempValues (const TargetMachine& target);
90
91 void freezeSpillsArea () { spillsAreaFrozen = true; }
92 void freezeAutomaticVarsArea () { automaticVarsAreaFrozen=true; }
9593
9694 int getOffset (const Value* val) const;
9795
119117 inline void resetTmpAreaSize() {
120118 currentTmpValuesSize = 0;
121119 }
122 inline void incrementCurrentOptionalArgsSize(int incr) {
123 currentOptionalArgsSize+= incr; // stack size already includes this!
124 }
120 int allocateOptionalArg (const TargetMachine& target,
121 const Type* type);
125122 };
126123
127124 #endif
2020
2121
2222 class MachineCodeForMethod : private Annotation {
23 const Function* method;
24 bool compiledAsLeaf;
23 std::hash_set constantsForConstPool;
24 std::hash_map offsets;
25 const Function* method;
2526 unsigned staticStackSize;
2627 unsigned automaticVarsSize;
2728 unsigned regSpillsSize;
28 unsigned currentOptionalArgsSize;
2929 unsigned maxOptionalArgsSize;
30 unsigned maxOptionalNumArgs;
3031 unsigned currentTmpValuesSize;
3132 unsigned maxTmpValuesSize;
32 std::hash_set constantsForConstPool;
33 std::hash_map offsets;
33 bool compiledAsLeaf;
34 bool spillsAreaFrozen;
35 bool automaticVarsAreaFrozen;
3436
3537 public:
3638 /*ctor*/ MachineCodeForMethod(const Function* function,
5658 inline unsigned getAutomaticVarsSize() const { return automaticVarsSize; }
5759 inline unsigned getRegSpillsSize() const { return regSpillsSize; }
5860 inline unsigned getMaxOptionalArgsSize() const { return maxOptionalArgsSize;}
59 inline unsigned getCurrentOptionalArgsSize() const
60 { return currentOptionalArgsSize;}
61 inline unsigned getMaxOptionalNumArgs() const { return maxOptionalNumArgs;}
6162 inline const std::hash_set&
6263 getConstantPoolValues() const {return constantsForConstPool;}
6364
7273 inline void markAsLeafMethod() { compiledAsLeaf = true; }
7374
7475 int computeOffsetforLocalVar (const TargetMachine& target,
75 const Value* local,
76 const Value* local,
7677 unsigned int& getPaddedSize,
7778 unsigned int sizeToUse = 0);
78
7979 int allocateLocalVar (const TargetMachine& target,
8080 const Value* local,
8181 unsigned int sizeToUse = 0);
8383 int allocateSpilledValue (const TargetMachine& target,
8484 const Type* type);
8585
86 int allocateOptionalArg (const TargetMachine& target,
87 const Type* type);
88
89 void resetOptionalArgs (const TargetMachine& target);
90
9186 int pushTempValue (const TargetMachine& target,
9287 unsigned int size);
9388
9489 void popAllTempValues (const TargetMachine& target);
90
91 void freezeSpillsArea () { spillsAreaFrozen = true; }
92 void freezeAutomaticVarsArea () { automaticVarsAreaFrozen=true; }
9593
9694 int getOffset (const Value* val) const;
9795
119117 inline void resetTmpAreaSize() {
120118 currentTmpValuesSize = 0;
121119 }
122 inline void incrementCurrentOptionalArgsSize(int incr) {
123 currentOptionalArgsSize+= incr; // stack size already includes this!
124 }
120 int allocateOptionalArg (const TargetMachine& target,
121 const Type* type);
125122 };
126123
127124 #endif