From 1db9b6957c2565a2322206bd5907530895f1c7ac Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 9 Jan 2013 23:36:50 +0000 Subject: Revert s/Raw/getBitMask/g name change. This is possibly causing LTO test hangings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172020 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Core.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/IR/Core.cpp') diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index 2024ac9..12cb971 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -1401,7 +1401,7 @@ void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) { LLVMAttribute LLVMGetFunctionAttr(LLVMValueRef Fn) { Function *Func = unwrap(Fn); const AttributeSet PAL = Func->getAttributes(); - return (LLVMAttribute)PAL.getBitMask(AttributeSet::FunctionIndex); + return (LLVMAttribute)PAL.Raw(AttributeSet::FunctionIndex); } /*--.. Operations on parameters ............................................--*/ @@ -1477,7 +1477,7 @@ void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA) { LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg) { Argument *A = unwrap(Arg); return (LLVMAttribute)A->getParent()->getAttributes(). - getBitMask(A->getArgNo()+1); + Raw(A->getArgNo()+1); } -- cgit v1.1 From defaca00b8087d452df2b783250a48a32658a910 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 22 Jan 2013 21:15:51 +0000 Subject: More encapsulation work. Use the AttributeSet when we're talking about more than one attribute. Add a function that adds a single attribute. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173196 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Core.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/IR/Core.cpp') diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index 12cb971..e72eb69 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -1383,8 +1383,9 @@ void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) { const AttributeSet PAL = Func->getAttributes(); AttrBuilder B(PA); const AttributeSet PALnew = - PAL.addAttr(Func->getContext(), AttributeSet::FunctionIndex, - Attribute::get(Func->getContext(), B)); + PAL.addFnAttributes(Func->getContext(), + AttributeSet::get(Func->getContext(), + AttributeSet::FunctionIndex, B)); Func->setAttributes(PALnew); } @@ -1676,8 +1677,9 @@ void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index, CallSite Call = CallSite(unwrap(Instr)); AttrBuilder B(PA); Call.setAttributes( - Call.getAttributes().addAttr(Call->getContext(), index, - Attribute::get(Call->getContext(), B))); + Call.getAttributes().addAttributes(Call->getContext(), index, + AttributeSet::get(Call->getContext(), + index, B))); } void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index, @@ -1694,8 +1696,10 @@ void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index, CallSite Call = CallSite(unwrap(Instr)); AttrBuilder B; B.addAlignmentAttr(align); - Call.setAttributes(Call.getAttributes().addAttr(Call->getContext(), index, - Attribute::get(Call->getContext(), B))); + Call.setAttributes(Call.getAttributes() + .addAttributes(Call->getContext(), index, + AttributeSet::get(Call->getContext(), + index, B))); } /*--.. Operations on call instructions (only) ..............................--*/ -- cgit v1.1 From 8246df61f6de716acf1f8c64fac3c19970a2c174 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 23 Jan 2013 00:45:55 +0000 Subject: Use the AttributeSet when removing multiple attributes. Use Attribute::AttrKind when removing one attribute. This further encapsulates the use of the attributes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173214 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Core.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/IR/Core.cpp') diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index e72eb69..0e42536 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -1394,8 +1394,9 @@ void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) { const AttributeSet PAL = Func->getAttributes(); AttrBuilder B(PA); const AttributeSet PALnew = - PAL.removeAttr(Func->getContext(), AttributeSet::FunctionIndex, - Attribute::get(Func->getContext(), B)); + PAL.removeAttributes(Func->getContext(), AttributeSet::FunctionIndex, + AttributeSet::get(Func->getContext(), + AttributeSet::FunctionIndex, B)); Func->setAttributes(PALnew); } @@ -1686,9 +1687,10 @@ void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index, LLVMAttribute PA) { CallSite Call = CallSite(unwrap(Instr)); AttrBuilder B(PA); - Call.setAttributes( - Call.getAttributes().removeAttr(Call->getContext(), index, - Attribute::get(Call->getContext(), B))); + Call.setAttributes(Call.getAttributes() + .removeAttributes(Call->getContext(), index, + AttributeSet::get(Call->getContext(), + index, B))); } void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index, -- cgit v1.1 From 28d65722d6f283b327b5815914382077fe9c0ab4 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 23 Jan 2013 06:14:59 +0000 Subject: Remove the last of uses that use the Attribute object as a collection of attributes. Collections of attributes are handled via the AttributeSet class now. This finally frees us up to make significant changes to how attributes are structured. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173228 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Core.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/IR/Core.cpp') diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index 0e42536..1e3258f 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -1467,13 +1467,13 @@ LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg) { void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA) { Argument *A = unwrap(Arg); AttrBuilder B(PA); - A->addAttr(Attribute::get(A->getContext(), B)); + A->addAttr(AttributeSet::get(A->getContext(), A->getArgNo() + 1, B)); } void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA) { Argument *A = unwrap(Arg); AttrBuilder B(PA); - A->removeAttr(Attribute::get(A->getContext(), B)); + A->removeAttr(AttributeSet::get(A->getContext(), A->getArgNo() + 1, B)); } LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg) { @@ -1484,10 +1484,10 @@ LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg) { void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align) { + Argument *A = unwrap(Arg); AttrBuilder B; B.addAlignmentAttr(align); - unwrap(Arg)->addAttr(Attribute:: - get(unwrap(Arg)->getContext(), B)); + A->addAttr(AttributeSet::get(A->getContext(),A->getArgNo() + 1, B)); } /*--.. Operations on basic blocks ..........................................--*/ -- cgit v1.1 From ac72eb264c3a8a15cda81aaead6adc8419058666 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 30 Jan 2013 23:40:31 +0000 Subject: Remove addRetAttributes and addFnAttributes, which aren't useful abstractions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173992 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Core.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/IR/Core.cpp') diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index 1e3258f..aaf661f 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -1383,9 +1383,9 @@ void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) { const AttributeSet PAL = Func->getAttributes(); AttrBuilder B(PA); const AttributeSet PALnew = - PAL.addFnAttributes(Func->getContext(), - AttributeSet::get(Func->getContext(), - AttributeSet::FunctionIndex, B)); + PAL.addAttributes(Func->getContext(), AttributeSet::FunctionIndex, + AttributeSet::get(Func->getContext(), + AttributeSet::FunctionIndex, B)); Func->setAttributes(PALnew); } -- cgit v1.1 From 68b2faf6be3a08064687a67a19efee0a713435de Mon Sep 17 00:00:00 2001 From: Sergei Larin Date: Fri, 8 Feb 2013 23:37:41 +0000 Subject: Enable *BasicBlockPass::createPrinterPass() Enables raw_ostream I/O for BasicBlockPass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174776 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Core.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/IR/Core.cpp') diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index aaf661f..b696ed0 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -39,6 +39,7 @@ void llvm::initializeCore(PassRegistry &Registry) { initializeDominatorTreePass(Registry); initializePrintModulePassPass(Registry); initializePrintFunctionPassPass(Registry); + initializePrintBasicBlockPassPass(Registry); initializeVerifierPass(Registry); initializePreVerifierPass(Registry); } -- cgit v1.1 From 31cfc707058ad3f470924cdb3c460c8f50ee76c3 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 14 Feb 2013 19:11:28 +0000 Subject: Add two new functions to the C API: LLVMCreateMemoryBufferWithMemoryRange - exposes MemoryBuffer::getMemBuffer LLVMCreateMemoryBufferWithMemoryRangeCopy - exposes MemoryBuffer::getMemBufferCopy Patch by Moritz Maxeiner! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175199 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Core.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/IR/Core.cpp') diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index b696ed0..10f870c 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -2369,6 +2369,29 @@ LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, return 1; } +LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange( + const char *InputData, + size_t InputDataLength, + const char *BufferName, + bool RequiresNullTerminator) { + + return wrap(MemoryBuffer::getMemBuffer( + StringRef(InputData, InputDataLength), + StringRef(BufferName), + RequiresNullTerminator)); +} + +LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy( + const char *InputData, + size_t InputDataLength, + const char *BufferName) { + + return wrap(MemoryBuffer::getMemBufferCopy( + StringRef(InputData, InputDataLength), + StringRef(BufferName))); +} + + void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf) { delete unwrap(MemBuf); } -- cgit v1.1 From aefd14be3951d5b84cda5561655fe63549819d25 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 14 Feb 2013 19:40:27 +0000 Subject: s/bool/LLVMBool/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175204 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Core.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/IR/Core.cpp') diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index 10f870c..79eb269 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -2373,7 +2373,7 @@ LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange( const char *InputData, size_t InputDataLength, const char *BufferName, - bool RequiresNullTerminator) { + LLVMBool RequiresNullTerminator) { return wrap(MemoryBuffer::getMemBuffer( StringRef(InputData, InputDataLength), -- cgit v1.1 From 906727dcfeb359acec4caca3ba8c756c4308ff6b Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Sun, 17 Feb 2013 16:35:51 +0000 Subject: Add multithreading functions and shutdown to the C API. Patch by Moritz Maxeiner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175398 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Core.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/IR/Core.cpp') diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index 79eb269..983b49c 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -26,9 +26,11 @@ #include "llvm/Support/CallSite.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/system_error.h" +#include "llvm/Support/Threading.h" #include #include #include @@ -48,6 +50,10 @@ void LLVMInitializeCore(LLVMPassRegistryRef R) { initializeCore(*unwrap(R)); } +void LLVMShutdown() { + llvm_shutdown(); +} + /*===-- Error handling ----------------------------------------------------===*/ void LLVMDisposeMessage(char *Message) { @@ -2436,3 +2442,17 @@ LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM) { void LLVMDisposePassManager(LLVMPassManagerRef PM) { delete unwrap(PM); } + +/*===-- Threading ------------------------------------------------------===*/ + +LLVMBool LLVMStartMultithreaded() { + return llvm_start_multithreaded(); +} + +void LLVMStopMultithreaded() { + llvm_stop_multithreaded(); +} + +LLVMBool LLVMIsMultithreaded() { + return llvm_is_multithreaded(); +} -- cgit v1.1