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 |