[PATCH] Add an option to allow JumpInstrTables to set unnamed_addr and jumptable on all address-taken functions

JF Bastien jfb at chromium.org
Mon Jun 30 09:57:09 PDT 2014


================
Comment at: include/llvm/CodeGen/CommandFlags.h:223
@@ +222,3 @@
+             cl::desc("Add unnamed_addr and jumptable to all address-taken"
+                      " functions"),
+             cl::init(false));
----------------
Say that unnamed_addr and jumptable are attributes that you're adding.

================
Comment at: lib/CodeGen/JumpInstrTables.cpp:271
@@ -266,1 +270,3 @@
       Functions[&F] = nullptr;
+    } else if (JumpTableAll && F.hasAddressTaken(nullptr)) {
+      F.setUnnamedAddr(true);
----------------
You don't need the nullptr here, it's the default value already.

================
Comment at: test/CodeGen/X86/jump_table_all.ll:33
@@ +32,3 @@
+; CHECK:         jmp     f at PLT
+; CHECK-NOT:     jmp     g at PLT
+
----------------
It's better to use CHECK-NEXT above. As-is, the g at PLT could be before f at PLT and the test would pass.

Should you also check for the absence of other __llvm_jump_instr_table_* ? Or is that covered in other tests?

http://reviews.llvm.org/D4128






More information about the llvm-commits mailing list