Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(583)

Side by Side Diff: src/IceCfgNode.cpp

Issue 1472623002: Unify alloca, outgoing arg, and prolog construction (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review fixes. Also removed StackAdjustment. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceAssemblerARM32.cpp ('k') | src/IceInstARM32.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===// 1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===//
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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 } 1085 }
1086 1086
1087 // Helper class for emitIAS(). 1087 // Helper class for emitIAS().
1088 namespace { 1088 namespace {
1089 class BundleEmitHelper { 1089 class BundleEmitHelper {
1090 BundleEmitHelper() = delete; 1090 BundleEmitHelper() = delete;
1091 BundleEmitHelper(const BundleEmitHelper &) = delete; 1091 BundleEmitHelper(const BundleEmitHelper &) = delete;
1092 BundleEmitHelper &operator=(const BundleEmitHelper &) = delete; 1092 BundleEmitHelper &operator=(const BundleEmitHelper &) = delete;
1093 1093
1094 public: 1094 public:
1095 BundleEmitHelper(Assembler *Asm, TargetLowering *Target, 1095 BundleEmitHelper(Assembler *Asm, const InstList &Insts)
1096 const InstList &Insts) 1096 : Asm(Asm), End(Insts.end()), BundleLockStart(End),
1097 : Asm(Asm), Target(Target), End(Insts.end()), BundleLockStart(End),
1098 BundleSize(1 << Asm->getBundleAlignLog2Bytes()), 1097 BundleSize(1 << Asm->getBundleAlignLog2Bytes()),
1099 BundleMaskLo(BundleSize - 1), BundleMaskHi(~BundleMaskLo) {} 1098 BundleMaskLo(BundleSize - 1), BundleMaskHi(~BundleMaskLo) {}
1100 // Check whether we're currently within a bundle_lock region. 1099 // Check whether we're currently within a bundle_lock region.
1101 bool isInBundleLockRegion() const { return BundleLockStart != End; } 1100 bool isInBundleLockRegion() const { return BundleLockStart != End; }
1102 // Check whether the current bundle_lock region has the align_to_end option. 1101 // Check whether the current bundle_lock region has the align_to_end option.
1103 bool isAlignToEnd() const { 1102 bool isAlignToEnd() const {
1104 assert(isInBundleLockRegion()); 1103 assert(isInBundleLockRegion());
1105 return llvm::cast<InstBundleLock>(getBundleLockStart())->getOption() == 1104 return llvm::cast<InstBundleLock>(getBundleLockStart())->getOption() ==
1106 InstBundleLock::Opt_AlignToEnd; 1105 InstBundleLock::Opt_AlignToEnd;
1107 } 1106 }
(...skipping 21 matching lines...) Expand all
1129 InstList::const_iterator getBundleLockStart() const { 1128 InstList::const_iterator getBundleLockStart() const {
1130 assert(isInBundleLockRegion()); 1129 assert(isInBundleLockRegion());
1131 return BundleLockStart; 1130 return BundleLockStart;
1132 } 1131 }
1133 // Set up bookkeeping when the bundle_lock instruction is first processed. 1132 // Set up bookkeeping when the bundle_lock instruction is first processed.
1134 void enterBundleLock(InstList::const_iterator I) { 1133 void enterBundleLock(InstList::const_iterator I) {
1135 assert(!isInBundleLockRegion()); 1134 assert(!isInBundleLockRegion());
1136 BundleLockStart = I; 1135 BundleLockStart = I;
1137 SizeSnapshotPre = Asm->getBufferSize(); 1136 SizeSnapshotPre = Asm->getBufferSize();
1138 Asm->setPreliminary(true); 1137 Asm->setPreliminary(true);
1139 Target->snapshotEmitState();
1140 assert(isInBundleLockRegion()); 1138 assert(isInBundleLockRegion());
1141 } 1139 }
1142 // Update bookkeeping when the bundle_unlock instruction is processed. 1140 // Update bookkeeping when the bundle_unlock instruction is processed.
1143 void enterBundleUnlock() { 1141 void enterBundleUnlock() {
1144 assert(isInBundleLockRegion()); 1142 assert(isInBundleLockRegion());
1145 SizeSnapshotPost = Asm->getBufferSize(); 1143 SizeSnapshotPost = Asm->getBufferSize();
1146 } 1144 }
1147 // Update bookkeeping when we are completely finished with the bundle_lock 1145 // Update bookkeeping when we are completely finished with the bundle_lock
1148 // region. 1146 // region.
1149 void leaveBundleLockRegion() { BundleLockStart = End; } 1147 void leaveBundleLockRegion() { BundleLockStart = End; }
(...skipping 19 matching lines...) Expand all
1169 Asm->padWithNop(BundleSize - Offset); 1167 Asm->padWithNop(BundleSize - Offset);
1170 SizeSnapshotPre = Asm->getBufferSize(); 1168 SizeSnapshotPre = Asm->getBufferSize();
1171 } 1169 }
1172 } 1170 }
1173 } 1171 }
1174 // Update bookkeeping when rolling back for the second pass. 1172 // Update bookkeeping when rolling back for the second pass.
1175 void rollback() { 1173 void rollback() {
1176 assert(isInBundleLockRegion()); 1174 assert(isInBundleLockRegion());
1177 Asm->setBufferSize(SizeSnapshotPre); 1175 Asm->setBufferSize(SizeSnapshotPre);
1178 Asm->setPreliminary(false); 1176 Asm->setPreliminary(false);
1179 Target->rollbackEmitState();
1180 } 1177 }
1181 1178
1182 private: 1179 private:
1183 Assembler *const Asm; 1180 Assembler *const Asm;
1184 TargetLowering *const Target;
1185 // End is a sentinel value such that BundleLockStart==End implies that we are 1181 // End is a sentinel value such that BundleLockStart==End implies that we are
1186 // not in a bundle_lock region. 1182 // not in a bundle_lock region.
1187 const InstList::const_iterator End; 1183 const InstList::const_iterator End;
1188 InstList::const_iterator BundleLockStart; 1184 InstList::const_iterator BundleLockStart;
1189 const intptr_t BundleSize; 1185 const intptr_t BundleSize;
1190 // Masking with BundleMaskLo identifies an address's bundle offset. 1186 // Masking with BundleMaskLo identifies an address's bundle offset.
1191 const intptr_t BundleMaskLo; 1187 const intptr_t BundleMaskLo;
1192 // Masking with BundleMaskHi identifies an address's bundle. 1188 // Masking with BundleMaskHi identifies an address's bundle.
1193 const intptr_t BundleMaskHi; 1189 const intptr_t BundleMaskHi;
1194 intptr_t SizeSnapshotPre = 0; 1190 intptr_t SizeSnapshotPre = 0;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 // bundle_lock region. The first pass is a preliminary pass, after which we 1225 // bundle_lock region. The first pass is a preliminary pass, after which we
1230 // can figure out what nop padding is needed, then roll back, and make the 1226 // can figure out what nop padding is needed, then roll back, and make the
1231 // final pass. 1227 // final pass.
1232 // 1228 //
1233 // Ideally, the first pass would be speculative and the second pass would 1229 // Ideally, the first pass would be speculative and the second pass would
1234 // only be done if nop padding were needed, but the structure of the 1230 // only be done if nop padding were needed, but the structure of the
1235 // integrated assembler makes it hard to roll back the state of label 1231 // integrated assembler makes it hard to roll back the state of label
1236 // bindings, label links, and relocation fixups. Instead, the first pass just 1232 // bindings, label links, and relocation fixups. Instead, the first pass just
1237 // disables all mutation of that state. 1233 // disables all mutation of that state.
1238 1234
1239 BundleEmitHelper Helper(Asm, Func->getTarget(), Insts); 1235 BundleEmitHelper Helper(Asm, Insts);
1240 InstList::const_iterator End = Insts.end(); 1236 InstList::const_iterator End = Insts.end();
1241 // Retrying indicates that we had to roll back to the bundle_lock instruction 1237 // Retrying indicates that we had to roll back to the bundle_lock instruction
1242 // to apply padding before the bundle_lock sequence. 1238 // to apply padding before the bundle_lock sequence.
1243 bool Retrying = false; 1239 bool Retrying = false;
1244 for (InstList::const_iterator I = Insts.begin(); I != End; ++I) { 1240 for (InstList::const_iterator I = Insts.begin(); I != End; ++I) {
1245 if (I->isDeleted() || I->isRedundantAssign()) 1241 if (I->isDeleted() || I->isRedundantAssign())
1246 continue; 1242 continue;
1247 1243
1248 if (llvm::isa<InstBundleLock>(I)) { 1244 if (llvm::isa<InstBundleLock>(I)) {
1249 // Set up the initial bundle_lock state. This should not happen while 1245 // Set up the initial bundle_lock state. This should not happen while
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 InstIntrinsicCall *Inst = InstIntrinsicCall::create( 1407 InstIntrinsicCall *Inst = InstIntrinsicCall::create(
1412 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); 1408 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info);
1413 Inst->addArg(AtomicRMWOp); 1409 Inst->addArg(AtomicRMWOp);
1414 Inst->addArg(Counter); 1410 Inst->addArg(Counter);
1415 Inst->addArg(One); 1411 Inst->addArg(One);
1416 Inst->addArg(OrderAcquireRelease); 1412 Inst->addArg(OrderAcquireRelease);
1417 Insts.push_front(Inst); 1413 Insts.push_front(Inst);
1418 } 1414 }
1419 1415
1420 } // end of namespace Ice 1416 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.cpp ('k') | src/IceInstARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698