This is an archive of the discontinued LLVM Phabricator instance.

[LLVM-C] Add bindings to insert basic blocks
ClosedPublic

Authored by CodaFi on Mar 21 2019, 11:28 AM.

Details

Summary

Now that we can create standalone basic blocks, it's useful to be able to append them. Add bindings to

  • Insert a basic block after the current insertion block
  • Append a basic block to the end of a function's list of basic blocks

Diff Detail

Repository
rL LLVM

Event Timeline

CodaFi created this revision.Mar 21 2019, 11:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2019, 11:28 AM
harlanhaskins accepted this revision.Mar 21 2019, 2:41 PM
This revision is now accepted and ready to land.Mar 21 2019, 2:41 PM
CodaFi added a comment.Apr 5 2019, 8:49 AM

@whitequark Could I get your sign off on this too?

I think the names are confusing. Why not something like LLVMInsertExistingBasicBlock and LLVMAppendExistingBasicBlock?

CodaFi added a comment.EditedApr 5 2019, 12:44 PM

I think the names are confusing. Why not something like LLVMInsertExistingBasicBlock and LLVMAppendExistingBasicBlock?

Like to match LLVMInsertBasicBlock and LLVMAppendBasicBlock? The former's semantics don't really match its pair function. LLVMInsertBasicBlock is used to insert before another block where LLVMInsertBasicBlockAfterInsertBlock inserts at the current global insertion point. I agree with the LLVMAppendExistingBasicBlock name change.

Agreed; I think it should still have Existing in the name if it takes a reference to a block, to distinguish from the existing set of (somewhat poorly named) functions.

CodaFi added a comment.Apr 5 2019, 1:01 PM

A (verbose) compromise: LLVMInsertExistingBasicBlockAfterInsertBlock?

CodaFi updated this revision to Diff 193952.Apr 5 2019, 1:13 PM
This revision was automatically updated to reflect the committed changes.