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

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 1168543002: Use report_fatal_error before destroying input object on error. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 6 months 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
OLDNEW
1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===//
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 // This file implements the TargetLoweringX8632 class, which 10 // This file implements the TargetLoweringX8632 class, which
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // If there is a separate locals area, this specifies the alignment 797 // If there is a separate locals area, this specifies the alignment
798 // for it. 798 // for it.
799 uint32_t LocalsSlotsAlignmentBytes = 0; 799 uint32_t LocalsSlotsAlignmentBytes = 0;
800 // The entire spill locations area gets aligned to largest natural 800 // The entire spill locations area gets aligned to largest natural
801 // alignment of the variables that have a spill slot. 801 // alignment of the variables that have a spill slot.
802 uint32_t SpillAreaAlignmentBytes = 0; 802 uint32_t SpillAreaAlignmentBytes = 0;
803 // A spill slot linked to a variable with a stack slot should reuse 803 // A spill slot linked to a variable with a stack slot should reuse
804 // that stack slot. 804 // that stack slot.
805 std::function<bool(Variable *)> TargetVarHook = 805 std::function<bool(Variable *)> TargetVarHook =
806 [&VariablesLinkedToSpillSlots](Variable *Var) { 806 [&VariablesLinkedToSpillSlots](Variable *Var) {
807 if (SpillVariable *SpillVar = llvm::dyn_cast<SpillVariable>(Var)) { 807 if (SpillVariable *SpillVar = llvm::dyn_cast<SpillVariable>(Var)) {
808 assert(Var->getWeight().isZero()); 808 assert(Var->getWeight().isZero());
809 if (SpillVar->getLinkedTo() && !SpillVar->getLinkedTo()->hasReg()) { 809 if (SpillVar->getLinkedTo() && !SpillVar->getLinkedTo()->hasReg()) {
810 VariablesLinkedToSpillSlots.push_back(Var); 810 VariablesLinkedToSpillSlots.push_back(Var);
811 return true; 811 return true;
812 } 812 }
813 } 813 }
814 return false; 814 return false;
815 }; 815 };
816 816
817 // Compute the list of spilled variables and bounds for GlobalsSize, etc. 817 // Compute the list of spilled variables and bounds for GlobalsSize, etc.
818 getVarStackSlotParams(SortedSpilledVariables, RegsUsed, &GlobalsSize, 818 getVarStackSlotParams(SortedSpilledVariables, RegsUsed, &GlobalsSize,
819 &SpillAreaSizeBytes, &SpillAreaAlignmentBytes, 819 &SpillAreaSizeBytes, &SpillAreaAlignmentBytes,
820 &LocalsSlotsAlignmentBytes, TargetVarHook); 820 &LocalsSlotsAlignmentBytes, TargetVarHook);
821 uint32_t LocalsSpillAreaSize = SpillAreaSizeBytes; 821 uint32_t LocalsSpillAreaSize = SpillAreaSizeBytes;
822 SpillAreaSizeBytes += GlobalsSize; 822 SpillAreaSizeBytes += GlobalsSize;
823 823
824 // Add push instructions for preserved registers. 824 // Add push instructions for preserved registers.
825 uint32_t NumCallee = 0; 825 uint32_t NumCallee = 0;
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2999 Context.insert( 2999 Context.insert(
3000 InstFakeUse::create(Func, Context.getLastInserted()->getDest())); 3000 InstFakeUse::create(Func, Context.getLastInserted()->getDest()));
3001 return; 3001 return;
3002 } 3002 }
3003 case Intrinsics::AtomicRMW: 3003 case Intrinsics::AtomicRMW:
3004 if (!Intrinsics::isMemoryOrderValid( 3004 if (!Intrinsics::isMemoryOrderValid(
3005 ID, getConstantMemoryOrder(Instr->getArg(3)))) { 3005 ID, getConstantMemoryOrder(Instr->getArg(3)))) {
3006 Func->setError("Unexpected memory ordering for AtomicRMW"); 3006 Func->setError("Unexpected memory ordering for AtomicRMW");
3007 return; 3007 return;
3008 } 3008 }
3009 lowerAtomicRMW(Instr->getDest(), 3009 lowerAtomicRMW(
3010 static_cast<uint32_t>(llvm::cast<ConstantInteger32>( 3010 Instr->getDest(),
3011 Instr->getArg(0))->getValue()), 3011 static_cast<uint32_t>(
3012 Instr->getArg(1), Instr->getArg(2)); 3012 llvm::cast<ConstantInteger32>(Instr->getArg(0))->getValue()),
3013 Instr->getArg(1), Instr->getArg(2));
3013 return; 3014 return;
3014 case Intrinsics::AtomicStore: { 3015 case Intrinsics::AtomicStore: {
3015 if (!Intrinsics::isMemoryOrderValid( 3016 if (!Intrinsics::isMemoryOrderValid(
3016 ID, getConstantMemoryOrder(Instr->getArg(2)))) { 3017 ID, getConstantMemoryOrder(Instr->getArg(2)))) {
3017 Func->setError("Unexpected memory ordering for AtomicStore"); 3018 Func->setError("Unexpected memory ordering for AtomicStore");
3018 return; 3019 return;
3019 } 3020 }
3020 // We require the memory address to be naturally aligned. 3021 // We require the memory address to be naturally aligned.
3021 // Given that is the case, then normal stores are atomic. 3022 // Given that is the case, then normal stores are atomic.
3022 // Add a fence after the store to make it visible. 3023 // Add a fence after the store to make it visible.
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after
4942 case FT_Asm: 4943 case FT_Asm:
4943 case FT_Iasm: { 4944 case FT_Iasm: {
4944 OstreamLocker L(Ctx); 4945 OstreamLocker L(Ctx);
4945 emitConstantPool<PoolTypeConverter<float>>(Ctx); 4946 emitConstantPool<PoolTypeConverter<float>>(Ctx);
4946 emitConstantPool<PoolTypeConverter<double>>(Ctx); 4947 emitConstantPool<PoolTypeConverter<double>>(Ctx);
4947 } break; 4948 } break;
4948 } 4949 }
4949 } 4950 }
4950 4951
4951 } // end of namespace Ice 4952 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698