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

Side by Side Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 1223133007: Factor out prelowerPhi for 32-bit targets. Disable adv phi lowering for ARM. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fill in wqthe random test case for more undef stuff Created 5 years, 5 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/IceTargetLoweringX86Base.h ('k') | tests_lit/llvm2ice_tests/64bit.pnacl.ll » ('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/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
11 /// This file implements the TargetLoweringX86Base class, which 11 /// This file implements the TargetLoweringX86Base class, which
12 /// consists almost entirely of the lowering sequence for each 12 /// consists almost entirely of the lowering sequence for each
13 /// high-level instruction. 13 /// high-level instruction.
14 /// 14 ///
15 //===----------------------------------------------------------------------===// 15 //===----------------------------------------------------------------------===//
16 16
17 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H 17 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H
18 #define SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H 18 #define SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H
19 19
20 #include "IceCfg.h" 20 #include "IceCfg.h"
21 #include "IceCfgNode.h" 21 #include "IceCfgNode.h"
22 #include "IceClFlags.h" 22 #include "IceClFlags.h"
23 #include "IceDefs.h" 23 #include "IceDefs.h"
24 #include "IceELFObjectWriter.h" 24 #include "IceELFObjectWriter.h"
25 #include "IceGlobalInits.h" 25 #include "IceGlobalInits.h"
26 #include "IceLiveness.h" 26 #include "IceLiveness.h"
27 #include "IceOperand.h" 27 #include "IceOperand.h"
28 #include "IcePhiLoweringImpl.h"
28 #include "IceUtils.h" 29 #include "IceUtils.h"
29 #include "llvm/Support/MathExtras.h" 30 #include "llvm/Support/MathExtras.h"
30 31
31 namespace Ice { 32 namespace Ice {
32 namespace X86Internal { 33 namespace X86Internal {
33 34
34 /// A helper class to ease the settings of RandomizationPoolingPause to disable 35 /// A helper class to ease the settings of RandomizationPoolingPause to disable
35 /// constant blinding or pooling for some translation phases. 36 /// constant blinding or pooling for some translation phases.
36 class BoolFlagSaver { 37 class BoolFlagSaver {
37 BoolFlagSaver() = delete; 38 BoolFlagSaver() = delete;
(...skipping 4651 matching lines...) Expand 10 before | Expand all | Expand 10 after
4689 } 4690 }
4690 4691
4691 /// Turn an i64 Phi instruction into a pair of i32 Phi instructions, to 4692 /// Turn an i64 Phi instruction into a pair of i32 Phi instructions, to
4692 /// preserve integrity of liveness analysis. Undef values are also 4693 /// preserve integrity of liveness analysis. Undef values are also
4693 /// turned into zeroes, since loOperand() and hiOperand() don't expect 4694 /// turned into zeroes, since loOperand() and hiOperand() don't expect
4694 /// Undef input. 4695 /// Undef input.
4695 template <class Machine> void TargetX86Base<Machine>::prelowerPhis() { 4696 template <class Machine> void TargetX86Base<Machine>::prelowerPhis() {
4696 // Pause constant blinding or pooling, blinding or pooling will be done later 4697 // Pause constant blinding or pooling, blinding or pooling will be done later
4697 // during phi lowering assignments 4698 // during phi lowering assignments
4698 BoolFlagSaver B(RandomizationPoolingPaused, true); 4699 BoolFlagSaver B(RandomizationPoolingPaused, true);
4699 4700 PhiLowering::prelowerPhis32Bit<TargetX86Base<Machine>>(
4700 CfgNode *Node = Context.getNode(); 4701 this, Context.getNode(), Func);
4701 for (Inst &I : Node->getPhis()) {
4702 auto Phi = llvm::dyn_cast<InstPhi>(&I);
4703 if (Phi->isDeleted())
4704 continue;
4705 Variable *Dest = Phi->getDest();
4706 if (Dest->getType() == IceType_i64) {
4707 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest));
4708 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest));
4709 InstPhi *PhiLo = InstPhi::create(Func, Phi->getSrcSize(), DestLo);
4710 InstPhi *PhiHi = InstPhi::create(Func, Phi->getSrcSize(), DestHi);
4711 for (SizeT I = 0; I < Phi->getSrcSize(); ++I) {
4712 Operand *Src = Phi->getSrc(I);
4713 CfgNode *Label = Phi->getLabel(I);
4714 Src = legalizeUndef(Src);
4715 PhiLo->addArgument(loOperand(Src), Label);
4716 PhiHi->addArgument(hiOperand(Src), Label);
4717 }
4718 Node->getPhis().push_back(PhiLo);
4719 Node->getPhis().push_back(PhiHi);
4720 Phi->setDeleted();
4721 }
4722 }
4723 } 4702 }
4724 4703
4725 bool isMemoryOperand(const Operand *Opnd) { 4704 bool isMemoryOperand(const Operand *Opnd) {
4726 if (const auto Var = llvm::dyn_cast<Variable>(Opnd)) 4705 if (const auto Var = llvm::dyn_cast<Variable>(Opnd))
4727 return !Var->hasReg(); 4706 return !Var->hasReg();
4728 // We treat vector undef values the same as a memory operand, 4707 // We treat vector undef values the same as a memory operand,
4729 // because they do in fact need a register to materialize the vector 4708 // because they do in fact need a register to materialize the vector
4730 // of zeroes into. 4709 // of zeroes into.
4731 if (llvm::isa<ConstantUndef>(Opnd)) 4710 if (llvm::isa<ConstantUndef>(Opnd))
4732 return isScalarFloatingType(Opnd->getType()) || 4711 return isScalarFloatingType(Opnd->getType()) ||
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
5427 } 5406 }
5428 // the offset is not eligible for blinding or pooling, return the original 5407 // the offset is not eligible for blinding or pooling, return the original
5429 // mem operand 5408 // mem operand
5430 return MemOperand; 5409 return MemOperand;
5431 } 5410 }
5432 5411
5433 } // end of namespace X86Internal 5412 } // end of namespace X86Internal
5434 } // end of namespace Ice 5413 } // end of namespace Ice
5435 5414
5436 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H 5415 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX86Base.h ('k') | tests_lit/llvm2ice_tests/64bit.pnacl.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698