[llvm] [llubi] Add basic support for icmp, terminators and function calls (PR #181393)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 14 01:15:52 PST 2026


================
@@ -17,7 +17,29 @@ namespace llvm::ubi {
 
 Context::Context(Module &M)
     : Ctx(M.getContext()), M(M), DL(M.getDataLayout()),
-      TLIImpl(M.getTargetTriple()) {}
+      TLIImpl(M.getTargetTriple()) {
+  // Register all valid function and block targets.
+  for (Function &F : M) {
+    auto FuncObj = allocate(0, F.getPointerAlignment(DL).value(), F.getName(),
----------------
nikic wrote:

Hm, the alignment situation for functions is a bit tricky. We have `F.getAlign()` for the function alignment (which is ignored here) and then `getFunctionPtrAlignType()`/`getFunctionPtrAlign()` for the alignment of the function pointer, which is not necessarily the same as the alignment of the function.

I don't believe function alignment is observable in llubi, so we should be working with the function pointer alignment here.

I guess we can't meaningfully observe the alignment right now, but should at least leave a TODO.

https://github.com/llvm/llvm-project/pull/181393


More information about the llvm-commits mailing list