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

Side by Side Diff: src/IceInstX8632.h

Issue 673543002: First pass at emitIAS for branches and binding labels (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: check the local labels too Created 6 years, 2 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/IceCfgNode.cpp ('k') | src/IceInstX8632.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/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// 1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- 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 // This file declares the InstX8632 and OperandX8632 classes and 10 // This file declares the InstX8632 and OperandX8632 classes and
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 protected: 268 protected:
269 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) 269 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest)
270 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} 270 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {}
271 ~InstX8632() override {} 271 ~InstX8632() override {}
272 static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) { 272 static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) {
273 return Inst->getKind() == static_cast<InstKind>(MyKind); 273 return Inst->getKind() == static_cast<InstKind>(MyKind);
274 } 274 }
275 }; 275 };
276 276
277 // InstX8632Label represents an intra-block label that is the 277 // InstX8632Label represents an intra-block label that is the target
278 // target of an intra-block branch. These are used for lowering i1 278 // of an intra-block branch. The offset between the label and the
279 // calculations, Select instructions, and 64-bit compares on a 32-bit 279 // branch must be fit into one byte (considered "near"). These are
280 // architecture, without basic block splitting. Basic block splitting 280 // used for lowering i1 calculations, Select instructions, and 64-bit
281 // is not so desirable for several reasons, one of which is the impact 281 // compares on a 32-bit architecture, without basic block splitting.
282 // on decisions based on whether a variable's live range spans 282 // Basic block splitting is not so desirable for several reasons, one
283 // multiple basic blocks. 283 // of which is the impact on decisions based on whether a variable's
284 // live range spans multiple basic blocks.
284 // 285 //
285 // Intra-block control flow must be used with caution. Consider the 286 // Intra-block control flow must be used with caution. Consider the
286 // sequence for "c = (a >= b ? x : y)". 287 // sequence for "c = (a >= b ? x : y)".
287 // cmp a, b 288 // cmp a, b
288 // br lt, L1 289 // br lt, L1
289 // mov c, x 290 // mov c, x
290 // jmp L2 291 // jmp L2
291 // L1: 292 // L1:
292 // mov c, y 293 // mov c, y
293 // L2: 294 // L2:
(...skipping 20 matching lines...) Expand all
314 class InstX8632Label : public InstX8632 { 315 class InstX8632Label : public InstX8632 {
315 InstX8632Label(const InstX8632Label &) = delete; 316 InstX8632Label(const InstX8632Label &) = delete;
316 InstX8632Label &operator=(const InstX8632Label &) = delete; 317 InstX8632Label &operator=(const InstX8632Label &) = delete;
317 318
318 public: 319 public:
319 static InstX8632Label *create(Cfg *Func, TargetX8632 *Target) { 320 static InstX8632Label *create(Cfg *Func, TargetX8632 *Target) {
320 return new (Func->allocate<InstX8632Label>()) InstX8632Label(Func, Target); 321 return new (Func->allocate<InstX8632Label>()) InstX8632Label(Func, Target);
321 } 322 }
322 uint32_t getEmitInstCount() const override { return 0; } 323 uint32_t getEmitInstCount() const override { return 0; }
323 IceString getName(const Cfg *Func) const; 324 IceString getName(const Cfg *Func) const;
325 SizeT getNumber() const { return Number; }
324 void emit(const Cfg *Func) const override; 326 void emit(const Cfg *Func) const override;
325 // TODO(jvoung): Filler in. 327 void emitIAS(const Cfg *Func) const override;
326 void emitIAS(const Cfg *Func) const override { emit(Func); }
327 void dump(const Cfg *Func) const override; 328 void dump(const Cfg *Func) const override;
328 329
329 private: 330 private:
330 InstX8632Label(Cfg *Func, TargetX8632 *Target); 331 InstX8632Label(Cfg *Func, TargetX8632 *Target);
331 ~InstX8632Label() override {} 332 ~InstX8632Label() override {}
332 SizeT Number; // used only for unique label string generation 333 SizeT Number; // used for unique label generation.
333 }; 334 };
334 335
335 // Conditional and unconditional branch instruction. 336 // Conditional and unconditional branch instruction.
336 class InstX8632Br : public InstX8632 { 337 class InstX8632Br : public InstX8632 {
337 InstX8632Br(const InstX8632Br &) = delete; 338 InstX8632Br(const InstX8632Br &) = delete;
338 InstX8632Br &operator=(const InstX8632Br &) = delete; 339 InstX8632Br &operator=(const InstX8632Br &) = delete;
339 340
340 public: 341 public:
341 // Create a conditional branch to a node. 342 // Create a conditional branch to a node.
342 static InstX8632Br *create(Cfg *Func, CfgNode *TargetTrue, 343 static InstX8632Br *create(Cfg *Func, CfgNode *TargetTrue,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 uint32_t Sum = 0; 379 uint32_t Sum = 0;
379 if (Label) 380 if (Label)
380 ++Sum; 381 ++Sum;
381 if (getTargetTrue()) 382 if (getTargetTrue())
382 ++Sum; 383 ++Sum;
383 if (getTargetFalse()) 384 if (getTargetFalse())
384 ++Sum; 385 ++Sum;
385 return Sum; 386 return Sum;
386 } 387 }
387 void emit(const Cfg *Func) const override; 388 void emit(const Cfg *Func) const override;
388 // TODO(jvoung): Filler in. 389 void emitIAS(const Cfg *Func) const override;
389 void emitIAS(const Cfg *Func) const override { emit(Func); }
390 void dump(const Cfg *Func) const override; 390 void dump(const Cfg *Func) const override;
391 static bool classof(const Inst *Inst) { return isClassof(Inst, Br); } 391 static bool classof(const Inst *Inst) { return isClassof(Inst, Br); }
392 392
393 private: 393 private:
394 InstX8632Br(Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse, 394 InstX8632Br(Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse,
395 const InstX8632Label *Label, CondX86::BrCond Condition); 395 const InstX8632Label *Label, CondX86::BrCond Condition);
396 ~InstX8632Br() override {} 396 ~InstX8632Br() override {}
397 CondX86::BrCond Condition; 397 CondX86::BrCond Condition;
398 const CfgNode *TargetTrue; 398 const CfgNode *TargetTrue;
399 const CfgNode *TargetFalse; 399 const CfgNode *TargetFalse;
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; 1544 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const;
1545 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; 1545 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const;
1546 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; 1546 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const;
1547 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; 1547 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const;
1548 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; 1548 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const;
1549 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; 1549 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const;
1550 1550
1551 } // end of namespace Ice 1551 } // end of namespace Ice
1552 1552
1553 #endif // SUBZERO_SRC_ICEINSTX8632_H 1553 #endif // SUBZERO_SRC_ICEINSTX8632_H
OLDNEW
« no previous file with comments | « src/IceCfgNode.cpp ('k') | src/IceInstX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698