Iasm and obj lowering for advanced switch lowering.
Jump table emission is delayed until offsets are known. X86 local jumps can be
near or far. Sanboxing is applied to indirect jumps from jump table.
BUG=
R=stichnot@chromium.org, jvoung
Review URL: https://codereview.chromium.org/1257283004.
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 51ca3f0..8bfc5dd 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -385,6 +385,8 @@
void GlobalContext::lowerConstants() { DataLowering->lowerConstants(); }
+void GlobalContext::lowerJumpTables() { DataLowering->lowerJumpTables(); }
+
void GlobalContext::lowerGlobals(const IceString &SectionSuffix) {
TimerMarker T(TimerStack::TT_emitGlobalInitializers, this);
const bool DumpGlobalVariables = BuildDefs::dump() && Flags.getVerbose() &&
@@ -876,6 +878,13 @@
return getConstPool()->ExternRelocatables.getConstantPool();
}
+JumpTableData &GlobalContext::addJumpTable(IceString FuncName, SizeT Id,
+ SizeT NumTargets) {
+ auto JumpTables = getJumpTables();
+ JumpTables->emplace_back(FuncName, Id, NumTargets);
+ return JumpTables->back();
+}
+
TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) {
if (!BuildDefs::dump())
return 0;