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

Unified Diff: src/IceInstX86BaseImpl.h

Issue 1257283004: Iasm and obj lowering for advanced switch lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceInstX86Base.h ('k') | src/IceSwitchLowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstX86BaseImpl.h
diff --git a/src/IceInstX86BaseImpl.h b/src/IceInstX86BaseImpl.h
index f80073e638735206c7f258eb0a2768126050e516..137e2954125862021059002d8d7d836e4f63d67e 100644
--- a/src/IceInstX86BaseImpl.h
+++ b/src/IceInstX86BaseImpl.h
@@ -105,10 +105,10 @@ template <class Machine>
InstX86Br<Machine>::InstX86Br(
Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse,
const InstX86Label<Machine> *Label,
- typename InstX86Base<Machine>::Traits::Cond::BrCond Condition)
+ typename InstX86Base<Machine>::Traits::Cond::BrCond Condition, Mode Kind)
: InstX86Base<Machine>(Func, InstX86Base<Machine>::Br, 0, nullptr),
Condition(Condition), TargetTrue(TargetTrue), TargetFalse(TargetFalse),
- Label(Label) {}
+ Label(Label), Kind(Kind) {}
template <class Machine>
bool InstX86Br<Machine>::optimizeBranch(const CfgNode *NextNode) {
@@ -404,7 +404,7 @@ template <class Machine>
void InstX86Label<Machine>::emitIAS(const Cfg *Func) const {
typename InstX86Base<Machine>::Traits::Assembler *Asm =
Func->getAssembler<typename InstX86Base<Machine>::Traits::Assembler>();
- Asm->BindLocalLabel(Number);
+ Asm->bindLocalLabel(Number);
}
template <class Machine>
@@ -446,31 +446,26 @@ void InstX86Br<Machine>::emitIAS(const Cfg *Func) const {
typename InstX86Base<Machine>::Traits::Assembler *Asm =
Func->getAssembler<typename InstX86Base<Machine>::Traits::Assembler>();
if (Label) {
- class Label *L = Asm->GetOrCreateLocalLabel(Label->getNumber());
- // In all these cases, local Labels should only be used for Near.
- const bool Near = true;
+ class Label *L = Asm->getOrCreateLocalLabel(Label->getNumber());
if (Condition == InstX86Base<Machine>::Traits::Cond::Br_None) {
- Asm->jmp(L, Near);
+ Asm->jmp(L, isNear());
} else {
- Asm->j(Condition, L, Near);
+ Asm->j(Condition, L, isNear());
}
} else {
- // Pessimistically assume it's far. This only affects Labels that
- // are not Bound.
- const bool Near = false;
if (Condition == InstX86Base<Machine>::Traits::Cond::Br_None) {
class Label *L =
- Asm->GetOrCreateCfgNodeLabel(getTargetFalse()->getIndex());
+ Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex());
assert(!getTargetTrue());
- Asm->jmp(L, Near);
+ Asm->jmp(L, isNear());
} else {
class Label *L =
- Asm->GetOrCreateCfgNodeLabel(getTargetTrue()->getIndex());
- Asm->j(Condition, L, Near);
+ Asm->getOrCreateCfgNodeLabel(getTargetTrue()->getIndex());
+ Asm->j(Condition, L, isNear());
if (getTargetFalse()) {
class Label *L2 =
- Asm->GetOrCreateCfgNodeLabel(getTargetFalse()->getIndex());
- Asm->jmp(L2, Near);
+ Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex());
+ Asm->jmp(L2, isNear());
}
}
}
@@ -498,6 +493,8 @@ template <class Machine> void InstX86Br<Machine>::dump(const Cfg *Func) const {
Str << ", label %" << getTargetFalse()->getName();
}
}
+
+ Str << " // (" << (isNear() ? "near" : "far") << " jump)";
}
template <class Machine> void InstX86Jmp<Machine>::emit(const Cfg *Func) const {
« no previous file with comments | « src/IceInstX86Base.h ('k') | src/IceSwitchLowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698