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

Unified Diff: src/IceInst.h

Issue 1860473002: Subzero. Refactors Switch Lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixes typo in comment. Created 4 years, 8 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/IceInst.h
diff --git a/src/IceInst.h b/src/IceInst.h
index 4fb74ae93d58010a513793bc44fa644bdd642900..39aa01a549408c66cb64dcacf83d4e1d6e6479c5 100644
--- a/src/IceInst.h
+++ b/src/IceInst.h
@@ -22,6 +22,7 @@
#include "IceDefs.h"
#include "IceInst.def"
#include "IceIntrinsics.h"
+#include "IceSwitchLowering.h"
#include "IceTypes.h"
// TODO: The Cfg structure, and instructions in particular, need to be
@@ -941,12 +942,18 @@ public:
static bool classof(const Inst *Instr) {
return Instr->getKind() == JumpTable;
}
+ // Creates a JumpTableData struct (used for ELF emission) that represents this
+ // InstJumpTable.
+ JumpTableData toJumpTableData(Assembler *Asm) const;
- // TODO(stichnot): Should this create&save GlobalString values?
- static std::string makeName(GlobalString FuncName, SizeT Id) {
- if (FuncName.hasStdString())
- return ".L" + FuncName + "$jumptable$__" + std::to_string(Id);
- return ".L" + std::to_string(FuncName.getID()) + "_" + std::to_string(Id);
+ // InstJumpTable is just a placeholder for the switch targets, and it does not
+ // need to emit any code, so we redefine emit and emitIAS to do nothing.
+ void emit(const Cfg *) const override {}
+ void emitIAS(const Cfg * /* Func */) const override {}
+
+ const std::string getName() const {
+ assert(Name.hasStdString());
+ return Name.toString();
}
private:
@@ -959,6 +966,8 @@ private:
const SizeT Id;
const SizeT NumTargets;
CfgNode **Targets;
+ GlobalString Name; // This JumpTable's name in the output.
+ GlobalString FuncName;
};
/// The Target instruction is the base class for all target-specific

Powered by Google App Engine
This is Rietveld 408576698