| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// | 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 } | 937 } |
| 938 if (Var->mustHaveReg()) { | 938 if (Var->mustHaveReg()) { |
| 939 llvm::report_fatal_error("Infinite-weight Variable (" + Var->getName() + | 939 llvm::report_fatal_error("Infinite-weight Variable (" + Var->getName() + |
| 940 ") has no register assigned - function " + | 940 ") has no register assigned - function " + |
| 941 Func->getFunctionName()); | 941 Func->getFunctionName()); |
| 942 } | 942 } |
| 943 const int32_t Offset = Var->getStackOffset(); | 943 const int32_t Offset = Var->getStackOffset(); |
| 944 auto BaseRegNum = Var->getBaseRegNum(); | 944 auto BaseRegNum = Var->getBaseRegNum(); |
| 945 if (BaseRegNum.hasNoValue()) | 945 if (BaseRegNum.hasNoValue()) |
| 946 BaseRegNum = getFrameOrStackReg(); | 946 BaseRegNum = getFrameOrStackReg(); |
| 947 // Print in the form "Offset(%reg)", taking care that: | |
| 948 // - Offset is never printed when it is 0 | |
| 949 | 947 |
| 950 const bool DecorateAsm = getFlags().getDecorateAsm(); | 948 // Print in the form "Offset(%reg)", omitting Offset when it is 0. |
| 951 // Only print Offset when it is nonzero, regardless of DecorateAsm. | 949 if (getFlags().getDecorateAsm()) { |
| 952 if (Offset) { | 950 Str << Var->getSymbolicStackOffset(); |
| 953 if (DecorateAsm) { | 951 } else if (Offset != 0) { |
| 954 Str << Var->getSymbolicStackOffset(); | 952 Str << Offset; |
| 955 } else { | |
| 956 Str << Offset; | |
| 957 } | |
| 958 } | 953 } |
| 959 const Type FrameSPTy = Traits::WordType; | 954 const Type FrameSPTy = Traits::WordType; |
| 960 Str << "(%" << getRegName(BaseRegNum, FrameSPTy) << ")"; | 955 Str << "(%" << getRegName(BaseRegNum, FrameSPTy) << ")"; |
| 961 } | 956 } |
| 962 | 957 |
| 963 template <typename TraitsType> | 958 template <typename TraitsType> |
| 964 typename TargetX86Base<TraitsType>::X86Address | 959 typename TargetX86Base<TraitsType>::X86Address |
| 965 TargetX86Base<TraitsType>::stackVarToAsmOperand(const Variable *Var) const { | 960 TargetX86Base<TraitsType>::stackVarToAsmOperand(const Variable *Var) const { |
| 966 if (Var->hasReg()) | 961 if (Var->hasReg()) |
| 967 llvm::report_fatal_error("Stack Variable has a register assigned"); | 962 llvm::report_fatal_error("Stack Variable has a register assigned"); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 InArgsSizeBytes); | 1199 InArgsSizeBytes); |
| 1205 } | 1200 } |
| 1206 | 1201 |
| 1207 // Fill in stack offsets for locals. | 1202 // Fill in stack offsets for locals. |
| 1208 assignVarStackSlots(SortedSpilledVariables, SpillAreaPaddingBytes, | 1203 assignVarStackSlots(SortedSpilledVariables, SpillAreaPaddingBytes, |
| 1209 SpillAreaSizeBytes, GlobalsAndSubsequentPaddingSize, | 1204 SpillAreaSizeBytes, GlobalsAndSubsequentPaddingSize, |
| 1210 IsEbpBasedFrame); | 1205 IsEbpBasedFrame); |
| 1211 // Assign stack offsets to variables that have been linked to spilled | 1206 // Assign stack offsets to variables that have been linked to spilled |
| 1212 // variables. | 1207 // variables. |
| 1213 for (Variable *Var : VariablesLinkedToSpillSlots) { | 1208 for (Variable *Var : VariablesLinkedToSpillSlots) { |
| 1214 const Variable *Linked = Var->getLinkedTo(); | 1209 const Variable *Root = Var->getLinkedToRoot(); |
| 1215 assert(Linked != nullptr); | 1210 assert(Root != nullptr); |
| 1216 Var->setStackOffset(Linked->getStackOffset()); | 1211 Var->setStackOffset(Root->getStackOffset()); |
| 1217 } | 1212 } |
| 1218 this->HasComputedFrame = true; | 1213 this->HasComputedFrame = true; |
| 1219 | 1214 |
| 1220 if (BuildDefs::dump() && Func->isVerbose(IceV_Frame)) { | 1215 if (BuildDefs::dump() && Func->isVerbose(IceV_Frame)) { |
| 1221 OstreamLocker L(Func->getContext()); | 1216 OstreamLocker L(Func->getContext()); |
| 1222 Ostream &Str = Func->getContext()->getStrDump(); | 1217 Ostream &Str = Func->getContext()->getStrDump(); |
| 1223 | 1218 |
| 1224 Str << "Stack layout:\n"; | 1219 Str << "Stack layout:\n"; |
| 1225 uint32_t EspAdjustmentPaddingSize = | 1220 uint32_t EspAdjustmentPaddingSize = |
| 1226 SpillAreaSizeBytes - LocalsSpillAreaSize - | 1221 SpillAreaSizeBytes - LocalsSpillAreaSize - |
| (...skipping 6805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8032 emitGlobal(*Var, SectionSuffix); | 8027 emitGlobal(*Var, SectionSuffix); |
| 8033 } | 8028 } |
| 8034 } | 8029 } |
| 8035 } break; | 8030 } break; |
| 8036 } | 8031 } |
| 8037 } | 8032 } |
| 8038 } // end of namespace X86NAMESPACE | 8033 } // end of namespace X86NAMESPACE |
| 8039 } // end of namespace Ice | 8034 } // end of namespace Ice |
| 8040 | 8035 |
| 8041 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 8036 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |