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

Unified Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 2177033002: Subzero: Local variable splitting. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Cleanup Created 4 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 side-by-side diff with in-line comments
Download patch
Index: src/IceTargetLoweringX86BaseImpl.h
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index 2acd3312d9b9b74c6a30853cc7cabcab2d2ff59d..8a7f3b0822679b3d3a0d146e26d7509d68016798 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -521,6 +521,7 @@ template <typename TraitsType> void TargetX86Base<TraitsType>::translateO2() {
initSandbox();
}
Func->dump("After x86 codegen");
+ Func->splitLocalVars();
// Register allocation. This requires instruction renumbering and full
// liveness analysis. Loops must be identified before liveness so variable
@@ -1042,11 +1043,11 @@ void TargetX86Base<TraitsType>::addProlog(CfgNode *Node) {
// stack slot.
std::function<bool(Variable *)> TargetVarHook =
[&VariablesLinkedToSpillSlots](Variable *Var) {
- if (Var->getLinkedTo() != nullptr) {
- // TODO(stichnot): This assert won't necessarily be true in the
- // future.
- assert(Var->mustNotHaveReg());
- if (!Var->getLinkedTo()->hasReg()) {
+ // TODO(stichnot): Refactor this into the base class.
+ Variable *Root = Var->getLinkedToStackRoot();
+ if (Root != nullptr) {
+ assert(!Root->hasReg());
+ if (!Root->hasReg()) {
VariablesLinkedToSpillSlots.push_back(Var);
return true;
}
@@ -1210,7 +1211,7 @@ void TargetX86Base<TraitsType>::addProlog(CfgNode *Node) {
// Assign stack offsets to variables that have been linked to spilled
// variables.
for (Variable *Var : VariablesLinkedToSpillSlots) {
- const Variable *Root = Var->getLinkedToRoot();
+ const Variable *Root = Var->getLinkedToStackRoot();
assert(Root != nullptr);
Var->setStackOffset(Root->getStackOffset());
}
@@ -1350,6 +1351,15 @@ void TargetX86Base<TraitsType>::addEpilog(CfgNode *Node) {
RI->setDeleted();
}
+template <typename TraitsType>
+Inst *TargetX86Base<TraitsType>::createLoweredMove(Variable *Dest,
+ Variable *SrcVar) {
+ if (isVectorType(Dest->getType())) {
+ return Traits::Insts::Movp::create(Func, Dest, SrcVar);
+ }
+ return Traits::Insts::Mov::create(Func, Dest, SrcVar);
+}
+
template <typename TraitsType> Type TargetX86Base<TraitsType>::stackSlotType() {
return Traits::WordType;
}
@@ -3124,7 +3134,7 @@ void TargetX86Base<TraitsType>::lowerCast(const InstCast *Instr) {
} else {
Src0 = legalize(Src0);
if (llvm::isa<X86OperandMem>(Src0)) {
- Variable *T = Func->makeVariable(DestTy);
+ Variable *T = makeReg(DestTy);
_movq(T, Src0);
_movq(Dest, T);
break;
« src/IceOperand.h ('K') | « src/IceTargetLoweringX86Base.h ('k') | src/IceTimerTree.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698