Displaying 20 results from an estimated 385 matches for "getcontext".
2012 Jul 04
2
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
...to the
llvm.annotation intrinsic function, which has a signature of (i32,
i8*, i8*, i32). The code is below.
void addAnnotation( BasicBlock *block, Function *F)
{
string foo = "foo";
string bar = "barr";
Type *charTy = Type::getInt8Ty(block->getContext());
ArrayType *s1Ty = ArrayType::get(charTy, foo.size()+1);
ArrayType *s2Ty = ArrayType::get(charTy, bar.size()+1);
Constant *ar1 = ConstantArray::get(block->getContext(), foo);
Constant *ar2 = ConstantArray::get(block->getContext(), bar);
GlobalVariable *g1...
2012 Jul 04
0
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
..., which has a signature of (i32,
> i8*, i8*, i32). The code is below.
>
> void addAnnotation( BasicBlock *block, Function *F)
> {
> string foo = "foo";
> string bar = "barr";
>
> Type *charTy = Type::getInt8Ty(block->getContext());
>
> ArrayType *s1Ty = ArrayType::get(charTy, foo.size()+1);
> ArrayType *s2Ty = ArrayType::get(charTy, bar.size()+1);
>
> Constant *ar1 = ConstantArray::get(block->getContext(), foo);
> Constant *ar2 = ConstantArray::get(block->getContext(),...
2012 Jun 17
3
[LLVMdev] BlockAddress instruction is copied instead of cloned during module link?
...64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64");
mod->setTargetTriple("x86_64-unknown-freebsd8.2");
// Type Definitions
PointerType* PointerTy_1 =
PointerType::get(IntegerType::get(mod->getContext(), 8), 0);
ArrayType* ArrayTy_0 = ArrayType::get(PointerTy_1, 3);
PointerType* PointerTy_2 = PointerType::get(ArrayTy_0, 0);
std::vector<Type*>FuncTy_3_args;
FuncTy_3_args.push_back(IntegerType::get(mod->getContext(), 32));
FunctionType* FuncTy_3 = FunctionType::get(
/*Resu...
2015 Jan 15
2
[LLVMdev] AllocaInst for FunctionType?
...gt;. FunstionType is a type, so
alloca for functionType should be possible? Not?
If we have a valid Module *m
we can get an allocate instruction allocating space for a non-argumented
function as follows:
AllocaInst* pa2 = new AllocaInst( FunctionType::get(
Type::getVoidTy(m->getContext()), false )
, 1, "myName");
but how about nonvar-argumented functions? E.g. I32,I16
std::vector<Type*>FuncTy_args;
FuncTy_args.push_back(IntegerType::get(mod->getContext(), 32));
FuncTy_args.push_back(IntegerType::get(mod->getContext(), 16));
AllocaInst* pa3 = new All...
2013 May 13
3
[LLVMdev] Q: When is a boolean not a boolean?
...d this is my
first real look at llvm's source.
This patch at least makes my problem go away;
@@ -2195,11 +2200,11 @@ bool GVN::processInstruction(Instruction *I) {
BasicBlock *Parent = BI->getParent();
bool Changed = false;
- Value *TrueVal = ConstantInt::getTrue(TrueSucc->getContext());
+ Value *TrueVal = ConstantInt::getTrue(BranchCond->getContext());
BasicBlockEdge TrueE(Parent, TrueSucc);
Changed |= propagateEquality(BranchCond, TrueVal, TrueE);
- Value *FalseVal = ConstantInt::getFalse(FalseSucc->getContext());
+ Value *FalseVal = ConstantInt::get...
2010 Nov 23
1
[LLVMdev] how to get a void type value in llvm
Hi, sivart
Thanks for pointing it out. I used it, and it works. Thank you again.
BTW, for any later reference, the function prototype declaration with
no arguments is not what I wrote:
fcall2 = M.getOrInsertFunction("foo",
IntegerType::get(M.getContext(), 32),
Type::getVoidTy(M.getContext()));
INSTEAD, I changed to :
fcall2 = M.getOrInsertFunction("foo", FunctionType::get(
IntegerType::get(M.getContext(), 32), false));
combining with this, the insertion works finally.
Thanks,
--Shuying
On Mon, Nov 22, 2010 at 6:07 PM, <o.j.si...
2013 Jan 27
2
[LLVMdev] Passing an array to an external function
...Inst::hasAllZeroIndices() const
+ 0
std::vector<Value*> Args(1);
//Vector with array values
SmallVector<Constant*, 2> counts;
counts.push_back(ConstantInt::get(Type::getInt32Ty(BB->getContext()),32,
false));
counts.push_back(ConstantInt::get(Type::getInt32Ty(BB->getContext()),12,
false));
//Array with 2 integers
ArrayType* ar_type =
llvm::ArrayType::get(llvm::Type::getInt32Ty(BI->getContext()),2);
Value* array = ConstantArray:...
2010 Nov 23
2
[LLVMdev] how to get a void type value in llvm
Hi, I want to insert a function with a void type parameter,
for example: int foo(void);
OI declared
fcall2 = M.getOrInsertFunction("foo",
IntegerType::get(M.getContext(), 32),
Type::getVoidTy(M.getContext()));
then the question is how to get the void type value to make the
CallInst inserted sucessfully? (what should be ********)
CallInst::Create(fcall2, ******, "", insertPos);
--
--Shuying
2012 Feb 01
1
[LLVMdev] Function Insertion Error
...llvm/Support/IRBuilder.h"
using namespace llvm;
namespace {
struct FunctionInsert : public ModulePass {
static char ID;
FunctionInsert() : ModulePass(ID) {}
};
virtual bool runOnModule(Module &M) {
FunctionType* ty=FunctionType::get(Type::getInt32Ty(M.getContext()),false);
Function *func = cast<Function>(M.getOrInsertFunction("func", ty,Type::getInt32Ty(M.getContext()), (Type *)0));
BasicBlock *BB = BasicBlock::Create(M.getContext(), "bb1", func);
IRBuilder<> builder(BB);
Value *One = builde...
2010 Nov 23
0
[LLVMdev] how to get a void type value in llvm
...amp; NameStr, BasicBlock * InsertAtEnd);
Regards
On 23/11/2010, at 11:20 AM, Shuying Liang wrote:
> Hi, I want to insert a function with a void type parameter,
> for example: int foo(void);
> OI declared
> fcall2 = M.getOrInsertFunction("foo",
> IntegerType::get(M.getContext(), 32),
> Type::getVoidTy(M.getContext()));
>
> then the question is how to get the void type value to make the
> CallInst inserted sucessfully? (what should be ********)
> CallInst::Create(fcall2, ******, "", insertPos);
>
>
> --
>
> --Shuying
&g...
2015 Mar 07
2
[LLVMdev] cannot understand global c++API code
...n it to me.
c code
---------------------------------
struct stest {
int age;
float weight;
} foo={44,67.2};
int main() {
foo.weight=68.2;
...
----------------------------------------
API code
// this is clear
ConstantFP* const_float_102 = ConstantFP::get(mod->getContext(),
APFloat(6.820000e+01f));
ConstantInt* const_int32_98 = ConstantInt::get(mod->getContext(), APInt(32,
StringRef("0"), 10));
ConstantInt* const_int32_99 = ConstantInt::get(mod->getContext(), APInt(32,
StringRef("1"), 10));
std::vector<Constant*> const_ptr_103...
2012 Sep 19
0
[LLVMdev] newbie question on getelementptr
...ction).
Here is my code:
// includes omitted
using namespace llvm;
using namespace std;
static Function *CreateAddFunction(Module *module) {
Function *func_add = cast<Function> (
module->getOrInsertFunction("add",
Type::getInt32Ty(module->getContext()),
Type::getInt32Ty(module->getContext()),
Type::getInt32Ty(module->getContext()), (Type *) 0));
BasicBlock *BB = BasicBlock::Create(module->getContext(), "Start",
func_add);
Function::arg_iterator args = func_add->arg_begin();...
2011 May 18
2
[LLVMdev] access array problem
...re operations in run-time
>> int *counterArray; //record the load/store addresses
> strictly speaking these are not arrays, they are pointers. Also, you have
> written them in some kind of C-style idiom. What are the declarations in
> LLVM IR?
const Type *IntTy = Type::getInt32Ty(M.getContext());
const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1);
GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false,
GlobalValue::InternalLinkage,
Constant::getNullValue(ATyC), "MemTraceCounterSize");
const Type *ATy = ArrayType::get(Type::getInt32Ty(M.getContex...
2015 Jun 02
2
[LLVMdev] Linking modules across contexts crashes
...ode gives the idea:
>>
>> bool linkModuleFromDifferentContext(Module &D, const Module &S) {
>> SmallVector<char, 256> Buffer;
>> writeBitcodeToBuffer(S, Buffer);
>>
>> std::unique_ptr<Module> M = readBitcodeFromBuffer(D.getContext());
>> return Linker::LinkModules(&D, M.get());
>> }
>
> Duncan,
>
> Thanks for this workaround, i works. However, going to binary and back causes the significant bump in the process user time (14s->16s), while the wall clock time still lower due to parall...
2014 Jan 08
3
[LLVMdev] reference to non-static member function must be called
...*p);
and in the Pass(a Function Pass ,and using the InstVistor template ), I
wrote like this:
void visitStoreInst(StoreInst &SI)
{
//Get the refference of the types
Module *M = SI.getParent()->getParent()->getParent();
IntegerType* Int8Type = IntegerType::getInt8Ty(M->getContext());
IntegerType* Int32Type = IntegerType::getInt32Ty(M->getContext());
IntegerType* Int64Type = IntegerType::getInt64Ty(M->getContext());
PointerType* VoidPtrType = PointerType::getUnqual(Int8Type);
Type* VoidType = Type::getVoidTy(M->getContext());
DataLayout *TD = &get...
2020 Jul 19
2
Instrument intrinsic invalid
...-dis to disassemble the result after opt, my pass will add a intrinsic after the load instruction, like following:
bool fpscan::ldAddMetadata (Instruction *Inst, StringRef c) {
std::vector<Metadata *> dataTuples;
// Add metadata in list
dataTuples.push_back(MDString::get(Inst->getContext(), c));
MDNode* N = MDNode::get(Inst->getContext(), dataTuples);
Value* meta = MetadataAsValue::get(Inst->getContext(), N);
std::vector<Value*> args;
args.push_back(meta);
IRBuilder<> Builder(Inst->getNextNode());
Builder.CreateCall(dbglabelPtr,...
2010 May 26
2
[LLVMdev] [llvm-commits] [llvm] r104737 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Hello-
Shouldn't this catch swapcontext as well?
Alistair
On 26 May 2010, at 22:14, Dale Johannesen wrote:
>
> On May 26, 2010, at 2:05 PMPDT, Dan Gohman wrote:
>
>> vfork and getcontext have wildly platform-dependent semantics.
>> Handling
>> them conservatively is reasonable, even if some platforms don't need
>> it.
>>
>> Dan
>
> Agreed. Also, the performance of code in the area of a vfork call is
> not going to be critical.
&g...
2015 Jun 01
2
[LLVMdev] Linking modules across contexts crashes
...into the
destination context. The following pseudo-code gives the idea:
bool linkModuleFromDifferentContext(Module &D, const Module &S) {
SmallVector<char, 256> Buffer;
writeBitcodeToBuffer(S, Buffer);
std::unique_ptr<Module> M = readBitcodeFromBuffer(D.getContext());
return Linker::LinkModules(&D, M.get());
}
> In any case, documentation for Linker::LinkModules should say if contexts are or aren't expected to be the same.
Good idea; patch welcome.
>
> Yuri
>
>
> ---testcase---
> #include "llvm/IR/LLVMContext...
2009 Sep 07
2
[LLVMdev] PR4882
Hello,
This patch fixes bug 4882.
Regards
-Jakub
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr4882.patch
Type: application/octet-stream
Size: 6856 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090907/266f900c/attachment.obj>
2009 Sep 07
0
[LLVMdev] PR4882
Hi Jakub, looks good.
> + LLVMContext *Context = &SI->getContext();
I guess this could be
LLVMContext &Context = SI->getContext();
which means you can use Context rather than *Context below.
> - const Type *Ty = Type::getInt64Ty(SI->getContext());
> - MemSetF = Intrinsic::getDeclaration(M, Intrinsic::memset, &Ty, 1);
> +...