Displaying 11 results from an estimated 11 matches for "getprimitivetyp".
Did you mean:
getprimitivetype
2005 Apr 21
0
[LLVMdev] Using LLVM for a dynamically typed language
...In the code I'm currently working on, I do the following to cast a
function pointer from one type to another. Hopefully the line wrapping
won't totally destroy this.
std::vector<const Type*> paramTypes;
// First parameter: a void pointer
paramTypes.push_back( PointerType::get( Type::getPrimitiveType( Type::SByteTyID ) ) );
FunctionType* pthreadFunctionType = FunctionType::get(
PointerType::get( Type::getPrimitiveType( Type::SByteTyID ) ),
paramTypes, false );
assert( pthreadFunctionType != NULL );
// Cast the function to the pthread function type
Value* castedFunction = new CastInst(...
2005 Apr 21
2
[LLVMdev] Using LLVM for a dynamically typed language
I recently ran into the following problem.
I'm prototyping a compiler for a dynamically typed language in which
functions are first class objects. Assuming I have something like
this:
if(rand() > 5)
i = define(x, y, z) { return x + y + z; }
else
i = define(x, y) { return x + y; }
At this point I cannot know the type of 'i' at compile time. At
runtime 'i' is a
2007 Apr 06
1
[LLVMdev] Integrating LLVM in an existing project
...d generating an unwind instruction straight after an unreachable
instruction, i.e. two terminators in a row.
(2)
- FuncCPPPersonality = cast<Function>(
+ FuncCPPPersonality =
TheModule->getOrInsertFunction("__gxx_personality_v0",
Type::getPrimitiveType(Type::VoidTyID),
- NULL));
- FuncCPPPersonality->setLinkage(Function::ExternalLinkage);
- FuncCPPPersonality->setCallingConv(CallingConv::C);
+ NULL);
- FuncUnwindResume = cast<Function>(
+ FuncUnwindResume =...
2007 Apr 06
0
[LLVMdev] Integrating LLVM in an existing project
On Fri, 6 Apr 2007, Nicolas Geoffray wrote:
> Like you say, it's not functional for non-calls instructions. Besides,
> having to change all CalInst to InvokeInst is just too much pain in our
> current vm.
ok.
> Actually, why is it missing? What's the difference between the code
> generator and the JIT?
There are two things missing:
1. Testing and working out the set
2007 Apr 06
2
[LLVMdev] Integrating LLVM in an existing project
Hi Chris,
Chris Lattner wrote:
>> We can not use current exception handling in llvm, see
>> http://www.nondot.org/sabre/LLVMNotes/ExceptionHandlingChanges.txt.
>>
>
> Why not?
>
>
Like you say, it's not functional for non-calls instructions. Besides,
having to change
all CalInst to InvokeInst is just too much pain in our current vm.
> There are two
2005 Apr 21
5
[LLVMdev] Using LLVM for a dynamically typed language
...ng on, I do the following to cast a
> function pointer from one type to another. Hopefully the line wrapping
> won't totally destroy this.
>
> std::vector<const Type*> paramTypes;
>
> // First parameter: a void pointer
> paramTypes.push_back( PointerType::get( Type::getPrimitiveType( Type::SByteTyID ) ) );
>
> FunctionType* pthreadFunctionType = FunctionType::get(
> PointerType::get( Type::getPrimitiveType( Type::SByteTyID ) ),
> paramTypes, false );
> assert( pthreadFunctionType != NULL );
>
> // Cast the function to the pthread functio...
2007 Apr 20
0
[LLVMdev] llvm-gcc Bug, Looking for Advice on Fix
...ll over llvm-convert.c. Tys and numTys
default to zero, which is why it builds. The problem is, getDeclaration
calls getType(id, Tys, numTys) where this code is executed:
case Intrinsic::memcpy_i32: // llvm.memcpy.i32
case Intrinsic::memmove_i32: // llvm.memmove.i32
ResultTy = Type::getPrimitiveType(Type::VoidTyID);
ArgTys.push_back(Tys[1]);
ArgTys.push_back(Tys[2]);
ArgTys.push_back(IntegerType::get(32));
ArgTys.push_back(IntegerType::get(32));
Oops, Tys is 0!
Similar code exists for llvm.memcpy.i64, so it's not the case that
the select expression returned the "...
2007 Feb 05
2
[LLVMdev] automatically generating intrinsic declarations
...ot;LLVMPackedType")) {
+ OS << "PackedType::get(";
+ EmitTypeGenerate(OS, ArgType->getValueAsDef("ElTy"));
+ OS << ", " << ArgType->getValueAsInt("NumElts") << ")";
+ } else {
+ OS << "Type::getPrimitiveType(";
+ OS << ArgType->getValueAsString("TypeVal") << ")";
+ }
+}
+
/// RecordListComparator - Provide a determinstic comparator for lists of
/// records.
namespace {
@@ -176,6 +192,43 @@
OS << "#endif\n\n";
}
+void IntrinsicEmitter...
2007 Apr 20
2
[LLVMdev] llvm-gcc Bug, Looking for Advice on Fix
Ok, I've tracked down the problem I've had bootstrapping
llvm-gcc. The culprit is in TreeToLLVM::EmitMemCpy:
void TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size,
unsigned Align) {
const Type *SBP = PointerType::get(Type::Int8Ty);
const Type *IntPtr = TD.getIntPtrType();
Value *Ops[4] = {
CastToType(Instruction::BitCast,
2007 Feb 05
0
[LLVMdev] automatically generating intrinsic declarations
On Mon, 5 Feb 2007, Dan Gohman wrote:
> LLVM knows what all the types of the intrinsic functions are; I thought,
> why are users (including llvm-gcc...) required to duplicate all this
> information in order to use them? I mean in order to call
> getOrInsertFunction to get declarations for them.
That is an excellent question! :) In the bad old days, we used to allow
intrinsics
2007 Feb 06
1
[LLVMdev] automatically generating intrinsic declarations
...EmitTypeGenerate(OS, ArgType->getValueAsDef("ElTy"));
+ OS << ")";
+ } else if (ArgType->isSubClassOf("LLVMEmptyStructType")) {
+ OS << "StructType::get(std::vector<const Type *>())";
+ } else {
+ OS << "Type::getPrimitiveType(";
+ OS << ArgType->getValueAsString("TypeVal") << ")";
+ }
+}
+
/// RecordListComparator - Provide a determinstic comparator for lists of
/// records.
namespace {
@@ -176,6 +198,43 @@
OS << "#endif\n\n";
}
+void IntrinsicEmitter...