diff options
author | Benji Smith <6193112+Benjins@users.noreply.github.com> | 2024-03-18 09:58:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 14:58:22 +0100 |
commit | a8bda0b4a6eb454cb437105efc98c807bd5c4f6d (patch) | |
tree | f809dbbfb1e108811332db835b190ce7ff05a7d3 /llvm/lib/IR | |
parent | 4294841ebcbb22076a24267cdf5164c7aeed9941 (diff) | |
download | llvm-a8bda0b4a6eb454cb437105efc98c807bd5c4f6d.zip llvm-a8bda0b4a6eb454cb437105efc98c807bd5c4f6d.tar.gz llvm-a8bda0b4a6eb454cb437105efc98c807bd5c4f6d.tar.bz2 |
[C API] Add accessors for function prefix and prologue data (#82193)
A test is added to echo.ll, and the echo.cpp part of llvm-c-test is
updated to clone a function's prefix and prologue.
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/Core.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index aacb163..023cabc 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -2422,6 +2422,38 @@ void LLVMSetGC(LLVMValueRef Fn, const char *GC) { F->clearGC(); } +LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn) { + Function *F = unwrap<Function>(Fn); + return wrap(F->getPrefixData()); +} + +LLVMBool LLVMHasPrefixData(LLVMValueRef Fn) { + Function *F = unwrap<Function>(Fn); + return F->hasPrefixData(); +} + +void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData) { + Function *F = unwrap<Function>(Fn); + Constant *prefix = unwrap<Constant>(prefixData); + F->setPrefixData(prefix); +} + +LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn) { + Function *F = unwrap<Function>(Fn); + return wrap(F->getPrologueData()); +} + +LLVMBool LLVMHasPrologueData(LLVMValueRef Fn) { + Function *F = unwrap<Function>(Fn); + return F->hasPrologueData(); +} + +void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData) { + Function *F = unwrap<Function>(Fn); + Constant *prologue = unwrap<Constant>(prologueData); + F->setPrologueData(prologue); +} + void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A) { unwrap<Function>(F)->addAttributeAtIndex(Idx, unwrap(A)); |