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

Side by Side Diff: src/IceTargetLoweringARM32.cpp

Issue 1961743002: Subzero: Update for LLVM 3.9 (trunk). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero@master
Patch Set: Remove unnecessary variable Created 4 years, 7 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
« no previous file with comments | « src/IceTargetLowering.cpp ('k') | src/PNaClTranslator.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/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 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 /// \file 10 /// \file
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 835
836 void TargetARM32::findMaxStackOutArgsSize() { 836 void TargetARM32::findMaxStackOutArgsSize() {
837 // MinNeededOutArgsBytes should be updated if the Target ever creates a 837 // MinNeededOutArgsBytes should be updated if the Target ever creates a
838 // high-level InstCall that requires more stack bytes. 838 // high-level InstCall that requires more stack bytes.
839 constexpr size_t MinNeededOutArgsBytes = 0; 839 constexpr size_t MinNeededOutArgsBytes = 0;
840 MaxOutArgsSizeBytes = MinNeededOutArgsBytes; 840 MaxOutArgsSizeBytes = MinNeededOutArgsBytes;
841 for (CfgNode *Node : Func->getNodes()) { 841 for (CfgNode *Node : Func->getNodes()) {
842 Context.init(Node); 842 Context.init(Node);
843 while (!Context.atEnd()) { 843 while (!Context.atEnd()) {
844 PostIncrLoweringContext PostIncrement(Context); 844 PostIncrLoweringContext PostIncrement(Context);
845 Inst *CurInstr = Context.getCur(); 845 Inst *CurInstr = iteratorToInst(Context.getCur());
846 if (auto *Call = llvm::dyn_cast<InstCall>(CurInstr)) { 846 if (auto *Call = llvm::dyn_cast<InstCall>(CurInstr)) {
847 SizeT OutArgsSizeBytes = getCallStackArgumentsSizeBytes(Call); 847 SizeT OutArgsSizeBytes = getCallStackArgumentsSizeBytes(Call);
848 MaxOutArgsSizeBytes = std::max(MaxOutArgsSizeBytes, OutArgsSizeBytes); 848 MaxOutArgsSizeBytes = std::max(MaxOutArgsSizeBytes, OutArgsSizeBytes);
849 } 849 }
850 } 850 }
851 } 851 }
852 } 852 }
853 853
854 void TargetARM32::createGotPtr() { 854 void TargetARM32::createGotPtr() {
855 if (SandboxingType != ST_Nonsfi) { 855 if (SandboxingType != ST_Nonsfi) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 break; 926 break;
927 } 927 }
928 } 928 }
929 929
930 if (DefGotPtr == nullptr || DefGotPtr->isDeleted()) { 930 if (DefGotPtr == nullptr || DefGotPtr->isDeleted()) {
931 return; 931 return;
932 } 932 }
933 933
934 // The got addr needs to be materialized at the same point where DefGotPtr 934 // The got addr needs to be materialized at the same point where DefGotPtr
935 // lives. 935 // lives.
936 Context.setInsertPoint(DefGotPtr); 936 Context.setInsertPoint(instToIterator(DefGotPtr));
937 assert(DefGotPtr->getSrcSize() == 1); 937 assert(DefGotPtr->getSrcSize() == 1);
938 auto *T = llvm::cast<Variable>(DefGotPtr->getSrc(0)); 938 auto *T = llvm::cast<Variable>(DefGotPtr->getSrc(0));
939 loadNamedConstantRelocatablePIC(Ctx->getGlobalString(GlobalOffsetTable), T, 939 loadNamedConstantRelocatablePIC(Ctx->getGlobalString(GlobalOffsetTable), T,
940 [this, T](Variable *PC) { _add(T, PC, T); }); 940 [this, T](Variable *PC) { _add(T, PC, T); });
941 _mov(GotPtr, T); 941 _mov(GotPtr, T);
942 DefGotPtr->setDeleted(); 942 DefGotPtr->setDeleted();
943 } 943 }
944 944
945 void TargetARM32::loadNamedConstantRelocatablePIC( 945 void TargetARM32::loadNamedConstantRelocatablePIC(
946 GlobalString Name, Variable *Register, 946 GlobalString Name, Variable *Register,
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 // It may help to be more coordinated about assign stack slot numbers and may 2032 // It may help to be more coordinated about assign stack slot numbers and may
2033 // help to assign smaller offsets to higher-weight variables so that they 2033 // help to assign smaller offsets to higher-weight variables so that they
2034 // don't depend on this legalization. 2034 // don't depend on this legalization.
2035 for (CfgNode *Node : Func->getNodes()) { 2035 for (CfgNode *Node : Func->getNodes()) {
2036 Context.init(Node); 2036 Context.init(Node);
2037 // One legalizer per basic block, otherwise we would share the Temporary 2037 // One legalizer per basic block, otherwise we would share the Temporary
2038 // Base Register between basic blocks. 2038 // Base Register between basic blocks.
2039 PostLoweringLegalizer Legalizer(this); 2039 PostLoweringLegalizer Legalizer(this);
2040 while (!Context.atEnd()) { 2040 while (!Context.atEnd()) {
2041 PostIncrLoweringContext PostIncrement(Context); 2041 PostIncrLoweringContext PostIncrement(Context);
2042 Inst *CurInstr = Context.getCur(); 2042 Inst *CurInstr = iteratorToInst(Context.getCur());
2043 2043
2044 // Check if the previous TempBaseReg is clobbered, and reset if needed. 2044 // Check if the previous TempBaseReg is clobbered, and reset if needed.
2045 Legalizer.resetTempBaseIfClobberedBy(CurInstr); 2045 Legalizer.resetTempBaseIfClobberedBy(CurInstr);
2046 2046
2047 if (auto *MovInstr = llvm::dyn_cast<InstARM32Mov>(CurInstr)) { 2047 if (auto *MovInstr = llvm::dyn_cast<InstARM32Mov>(CurInstr)) {
2048 Legalizer.legalizeMov(MovInstr); 2048 Legalizer.legalizeMov(MovInstr);
2049 } else if (auto *LdrInstr = llvm::dyn_cast<InstARM32Ldr>(CurInstr)) { 2049 } else if (auto *LdrInstr = llvm::dyn_cast<InstARM32Ldr>(CurInstr)) {
2050 if (OperandARM32Mem *LegalMem = Legalizer.legalizeMemOperand( 2050 if (OperandARM32Mem *LegalMem = Legalizer.legalizeMemOperand(
2051 llvm::cast<OperandARM32Mem>(LdrInstr->getSrc(0)))) { 2051 llvm::cast<OperandARM32Mem>(LdrInstr->getSrc(0)))) {
2052 Sandboxer(this) 2052 Sandboxer(this)
(...skipping 3690 matching lines...) Expand 10 before | Expand all | Expand 10 after
5743 return OperandARM32Mem::create(Func, Ty, BaseVar, OffsetR, ShiftKind, 5743 return OperandARM32Mem::create(Func, Ty, BaseVar, OffsetR, ShiftKind,
5744 OffsetRegShamt); 5744 OffsetRegShamt);
5745 } 5745 }
5746 5746
5747 return OperandARM32Mem::create( 5747 return OperandARM32Mem::create(
5748 Func, Ty, BaseVar, 5748 Func, Ty, BaseVar,
5749 llvm::cast<ConstantInteger32>(Ctx->getConstantInt32(OffsetImm))); 5749 llvm::cast<ConstantInteger32>(Ctx->getConstantInt32(OffsetImm)));
5750 } 5750 }
5751 5751
5752 void TargetARM32::doAddressOptLoad() { 5752 void TargetARM32::doAddressOptLoad() {
5753 Inst *Instr = Context.getCur(); 5753 Inst *Instr = iteratorToInst(Context.getCur());
5754 assert(llvm::isa<InstLoad>(Instr)); 5754 assert(llvm::isa<InstLoad>(Instr));
5755 Variable *Dest = Instr->getDest(); 5755 Variable *Dest = Instr->getDest();
5756 Operand *Addr = Instr->getSrc(0); 5756 Operand *Addr = Instr->getSrc(0);
5757 if (OperandARM32Mem *Mem = 5757 if (OperandARM32Mem *Mem =
5758 formAddressingMode(Dest->getType(), Func, Instr, Addr)) { 5758 formAddressingMode(Dest->getType(), Func, Instr, Addr)) {
5759 Instr->setDeleted(); 5759 Instr->setDeleted();
5760 Context.insert<InstLoad>(Dest, Mem); 5760 Context.insert<InstLoad>(Dest, Mem);
5761 } 5761 }
5762 } 5762 }
5763 5763
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
5905 Variable *ValueLo = legalizeToReg(loOperand(Value)); 5905 Variable *ValueLo = legalizeToReg(loOperand(Value));
5906 _str(ValueHi, llvm::cast<OperandARM32Mem>(hiOperand(NewAddr))); 5906 _str(ValueHi, llvm::cast<OperandARM32Mem>(hiOperand(NewAddr)));
5907 _str(ValueLo, llvm::cast<OperandARM32Mem>(loOperand(NewAddr))); 5907 _str(ValueLo, llvm::cast<OperandARM32Mem>(loOperand(NewAddr)));
5908 } else { 5908 } else {
5909 Variable *ValueR = legalizeToReg(Value); 5909 Variable *ValueR = legalizeToReg(Value);
5910 _str(ValueR, NewAddr); 5910 _str(ValueR, NewAddr);
5911 } 5911 }
5912 } 5912 }
5913 5913
5914 void TargetARM32::doAddressOptStore() { 5914 void TargetARM32::doAddressOptStore() {
5915 Inst *Instr = Context.getCur(); 5915 Inst *Instr = iteratorToInst(Context.getCur());
5916 assert(llvm::isa<InstStore>(Instr)); 5916 assert(llvm::isa<InstStore>(Instr));
5917 Operand *Src = Instr->getSrc(0); 5917 Operand *Src = Instr->getSrc(0);
5918 Operand *Addr = Instr->getSrc(1); 5918 Operand *Addr = Instr->getSrc(1);
5919 if (OperandARM32Mem *Mem = 5919 if (OperandARM32Mem *Mem =
5920 formAddressingMode(Src->getType(), Func, Instr, Addr)) { 5920 formAddressingMode(Src->getType(), Func, Instr, Addr)) {
5921 Instr->setDeleted(); 5921 Instr->setDeleted();
5922 Context.insert<InstStore>(Src, Mem); 5922 Context.insert<InstStore>(Src, Mem);
5923 } 5923 }
5924 } 5924 }
5925 5925
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
7146 // However, for compatibility with current NaCl LLVM, don't claim that. 7146 // However, for compatibility with current NaCl LLVM, don't claim that.
7147 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; 7147 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n";
7148 } 7148 }
7149 7149
7150 SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; 7150 SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM];
7151 SmallBitVector TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM]; 7151 SmallBitVector TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM];
7152 SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; 7152 SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM];
7153 7153
7154 } // end of namespace ARM32 7154 } // end of namespace ARM32
7155 } // end of namespace Ice 7155 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLowering.cpp ('k') | src/PNaClTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698