[llvm-dev] Force casting a Value*

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev

I am trying to cast a Value* irrespective of  its underlying subclass to uint64 and pass it on to a method as an argument.

if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
                    Value* vo = store_inst->getValueOperand();
                     uint64 value = /* cast vo to unsigned int 64 bit */
                     func(value);
                }

How can I force cast 'vo' to unsigned int?

--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev
Sounds like you're looking for reinterpret_cast: http://en.cppreference.com/w/cpp/language/reinterpret_cast

On Sun, Jun 11, 2017 at 3:06 AM Dipanjan Das via llvm-dev <[hidden email]> wrote:

I am trying to cast a Value* irrespective of  its underlying subclass to uint64 and pass it on to a method as an argument.

if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
                    Value* vo = store_inst->getValueOperand();
                     uint64 value = /* cast vo to unsigned int 64 bit */
                     func(value);
                }

How can I force cast 'vo' to unsigned int?

--

Thanks & Regards,

Dipanjan
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev


On 11 June 2017 at 07:53, David Blaikie <[hidden email]> wrote:
Sounds like you're looking for reinterpret_cast: http://en.cppreference.com/w/cpp/language/reinterpret_cast

I tried cast<ConstInt>(vo), but that failed at run-time.
 

On Sun, Jun 11, 2017 at 3:06 AM Dipanjan Das via llvm-dev <[hidden email]> wrote:

I am trying to cast a Value* irrespective of  its underlying subclass to uint64 and pass it on to a method as an argument.

if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
                    Value* vo = store_inst->getValueOperand();
                     uint64 value = /* cast vo to unsigned int 64 bit */
                     func(value);
                }

How can I force cast 'vo' to unsigned int?

--

Thanks & Regards,

Dipanjan
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev
On Sun, Jun 11, 2017 at 7:49 PM, Dipanjan Das via llvm-dev <[hidden email]> wrote:


On 11 June 2017 at 07:53, David Blaikie <[hidden email]> wrote:
Sounds like you're looking for reinterpret_cast: http://en.cppreference.com/w/cpp/language/reinterpret_cast

I tried cast<ConstInt>(vo), but that failed at run-time.

That is not the same as reinterpret_cast<int64>(some_value_star).

Or better yet, reinterpret_cast<intptr_t>(some_value_star)

http://www.cplusplus.com/reference/cstdint/

Cheers,

  -- nikodemus
 
 

On Sun, Jun 11, 2017 at 3:06 AM Dipanjan Das via llvm-dev <[hidden email]> wrote:

I am trying to cast a Value* irrespective of  its underlying subclass to uint64 and pass it on to a method as an argument.

if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
                    Value* vo = store_inst->getValueOperand();
                     uint64 value = /* cast vo to unsigned int 64 bit */
                     func(value);
                }

How can I force cast 'vo' to unsigned int?

--

Thanks & Regards,

Dipanjan
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev


On 11 June 2017 at 11:32, Nikodemus Siivola <[hidden email]> wrote:
On Sun, Jun 11, 2017 at 7:49 PM, Dipanjan Das via llvm-dev <[hidden email]> wrote:


On 11 June 2017 at 07:53, David Blaikie <[hidden email]> wrote:
Sounds like you're looking for reinterpret_cast: http://en.cppreference.com/w/cpp/language/reinterpret_cast

I tried cast<ConstInt>(vo), but that failed at run-time.

That is not the same as reinterpret_cast<int64>(some_value_star).

None of the following work.

Value* var_value = reinterpret_cast<intptr_t>(vo);
Value* var_value= reinterpret_cast<uint64_t>(vo);

The following worked, still didn't solve the problem:

Value* var_value = reinterpret_cast<ConstantInt*>(vo);
 
I can't pass var_value to a function accepting uint64_t. LLVM complains about broken function call.


Or better yet, reinterpret_cast<intptr_t>(some_value_star)

http://www.cplusplus.com/reference/cstdint/

Cheers,

  -- nikodemus
 
 

On Sun, Jun 11, 2017 at 3:06 AM Dipanjan Das via llvm-dev <[hidden email]> wrote:

I am trying to cast a Value* irrespective of  its underlying subclass to uint64 and pass it on to a method as an argument.

if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
                    Value* vo = store_inst->getValueOperand();
                     uint64 value = /* cast vo to unsigned int 64 bit */
                     func(value);
                }

How can I force cast 'vo' to unsigned int?

--

Thanks & Regards,

Dipanjan
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev





--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev
On 11 June 2017 at 11:56, Dipanjan Das via llvm-dev
<[hidden email]> wrote:
> I can't pass var_value to a function accepting uint64_t. LLVM complains
> about broken function call.

Well, yes. var_value has type "ConstantInt *", not uint64_t. Assuming
the value being stored actually is a constant known at compile-time
you should be able to use cast<ConstantInt *>(vo)->getZExtValue() to
retrieve a uint64_t value (careful of i128s!).

If that cast fails then you're not dealing with a constant store. This
is either a nuisance (if you were expecting the possibility and can
deal with it) or a huge misunderstanding over compile-time vs runtime
values.

If it's a nuisance, you can use "dyn_cast" instead of "cast". That'll
return nullptr if the store wasn't a constant instead of crashing; you
can decide what to do at that point.

Cheers.

Tim.
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev


On 11 June 2017 at 12:05, Tim Northover <[hidden email]> wrote:
On 11 June 2017 at 11:56, Dipanjan Das via llvm-dev
<[hidden email]> wrote:
> I can't pass var_value to a function accepting uint64_t. LLVM complains
> about broken function call.

Well, yes. var_value has type "ConstantInt *", not uint64_t. Assuming
the value being stored actually is a constant known at compile-time
you should be able to use cast<ConstantInt *>(vo)->getZExtValue() to
retrieve a uint64_t value (careful of i128s!).

If that cast fails then you're not dealing with a constant store. This
is either a nuisance (if you were expecting the possibility and can
deal with it) or a huge misunderstanding over compile-time vs runtime
values.

I think it's a misunderstanding in may part. Let me explain my intention first. I want to retrieve the value (if isPointerTy() returns true) to be stored by a store instruction at run-time and pass on that value as either an unsigned int (64) or a pointer (char*) to an external function. The call to that function is inserted using IRBuilder.CreateCall().

Consider the code snippet below.

==================================================

if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
                    Value* vo = store_inst->getValueOperand();
                     uint64 var_value = /* cast vo to unsigned int 64 bit */

                   // Pass on this value to external function
                    IRBuilder<> builder(&I);
                    builder.SetInsertPoint(&B, ++builder.GetInsertPoint());
                    Constant *func = F.getParent()->getOrInsertFunction("instrument_store", 
                                                                  Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), NULL);
                    Value* args[] = {var_value};
                    builder.CreateCall(func, args);
 }

==================================================

To reiterate, I want to wrap up the run-time value (var_value) as a Value* and call the method (instrument_store) with that value as an argument.

 
If it's a nuisance, you can use "dyn_cast" instead of "cast". That'll
return nullptr if the store wasn't a constant instead of crashing; you
can decide what to do at that point.

Cheers.

Tim.



--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev
Assuming you know it's a 64 bit value, and the function you are calling takes a uint64_t, try this:

Value* args[] = {store_inst->getOperand(0)};


On Sun, Jun 11, 2017 at 1:16 PM, Dipanjan Das via llvm-dev <[hidden email]> wrote:


On 11 June 2017 at 12:05, Tim Northover <[hidden email]> wrote:
On 11 June 2017 at 11:56, Dipanjan Das via llvm-dev
<[hidden email]> wrote:
> I can't pass var_value to a function accepting uint64_t. LLVM complains
> about broken function call.

Well, yes. var_value has type "ConstantInt *", not uint64_t. Assuming
the value being stored actually is a constant known at compile-time
you should be able to use cast<ConstantInt *>(vo)->getZExtValue() to
retrieve a uint64_t value (careful of i128s!).

If that cast fails then you're not dealing with a constant store. This
is either a nuisance (if you were expecting the possibility and can
deal with it) or a huge misunderstanding over compile-time vs runtime
values.

I think it's a misunderstanding in may part. Let me explain my intention first. I want to retrieve the value (if isPointerTy() returns true) to be stored by a store instruction at run-time and pass on that value as either an unsigned int (64) or a pointer (char*) to an external function. The call to that function is inserted using IRBuilder.CreateCall().

Consider the code snippet below.

==================================================

if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
                    Value* vo = store_inst->getValueOperand();
                     uint64 var_value = /* cast vo to unsigned int 64 bit */

                   // Pass on this value to external function
                    IRBuilder<> builder(&I);
                    builder.SetInsertPoint(&B, ++builder.GetInsertPoint());
                    Constant *func = F.getParent()->getOrInsertFunction("instrument_store", 
                                                                  Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), NULL);
                    Value* args[] = {var_value};
                    builder.CreateCall(func, args);
 }

==================================================

To reiterate, I want to wrap up the run-time value (var_value) as a Value* and call the method (instrument_store) with that value as an argument.

 
If it's a nuisance, you can use "dyn_cast" instead of "cast". That'll
return nullptr if the store wasn't a constant instead of crashing; you
can decide what to do at that point.

Cheers.

Tim.



--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev


On 11 June 2017 at 14:04, don hinton <[hidden email]> wrote:
Assuming you know it's a 64 bit value, and the function you are calling takes a uint64_t, try this:

The values from the test program are of type: i32/i32*/i32**. Can't I interpret these as uint64_t some way?
 

Value* args[] = {store_inst->getOperand(0)};


On Sun, Jun 11, 2017 at 1:16 PM, Dipanjan Das via llvm-dev <[hidden email]> wrote:


On 11 June 2017 at 12:05, Tim Northover <[hidden email]> wrote:
On 11 June 2017 at 11:56, Dipanjan Das via llvm-dev
<[hidden email]> wrote:
> I can't pass var_value to a function accepting uint64_t. LLVM complains
> about broken function call.

Well, yes. var_value has type "ConstantInt *", not uint64_t. Assuming
the value being stored actually is a constant known at compile-time
you should be able to use cast<ConstantInt *>(vo)->getZExtValue() to
retrieve a uint64_t value (careful of i128s!).

If that cast fails then you're not dealing with a constant store. This
is either a nuisance (if you were expecting the possibility and can
deal with it) or a huge misunderstanding over compile-time vs runtime
values.

I think it's a misunderstanding in may part. Let me explain my intention first. I want to retrieve the value (if isPointerTy() returns true) to be stored by a store instruction at run-time and pass on that value as either an unsigned int (64) or a pointer (char*) to an external function. The call to that function is inserted using IRBuilder.CreateCall().

Consider the code snippet below.

==================================================

if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
                    Value* vo = store_inst->getValueOperand();
                     uint64 var_value = /* cast vo to unsigned int 64 bit */

                   // Pass on this value to external function
                    IRBuilder<> builder(&I);
                    builder.SetInsertPoint(&B, ++builder.GetInsertPoint());
                    Constant *func = F.getParent()->getOrInsertFunction("instrument_store", 
                                                                  Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), NULL);
                    Value* args[] = {var_value};
                    builder.CreateCall(func, args);
 }

==================================================

To reiterate, I want to wrap up the run-time value (var_value) as a Value* and call the method (instrument_store) with that value as an argument.

 
If it's a nuisance, you can use "dyn_cast" instead of "cast". That'll
return nullptr if the store wasn't a constant instead of crashing; you
can decide what to do at that point.

Cheers.

Tim.



--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev





--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev
Sure, you can call store_inst->getOperand(0)->getType(), and call different functions based on the type, e.g., foo_8, foo_16, foo_32, etc...



On Sun, Jun 11, 2017 at 6:05 PM, Dipanjan Das via llvm-dev <[hidden email]> wrote:


On 11 June 2017 at 14:04, don hinton <[hidden email]> wrote:
Assuming you know it's a 64 bit value, and the function you are calling takes a uint64_t, try this:

The values from the test program are of type: i32/i32*/i32**. Can't I interpret these as uint64_t some way?
 

Value* args[] = {store_inst->getOperand(0)};


On Sun, Jun 11, 2017 at 1:16 PM, Dipanjan Das via llvm-dev <[hidden email]> wrote:


On 11 June 2017 at 12:05, Tim Northover <[hidden email]> wrote:
On 11 June 2017 at 11:56, Dipanjan Das via llvm-dev
<[hidden email]> wrote:
> I can't pass var_value to a function accepting uint64_t. LLVM complains
> about broken function call.

Well, yes. var_value has type "ConstantInt *", not uint64_t. Assuming
the value being stored actually is a constant known at compile-time
you should be able to use cast<ConstantInt *>(vo)->getZExtValue() to
retrieve a uint64_t value (careful of i128s!).

If that cast fails then you're not dealing with a constant store. This
is either a nuisance (if you were expecting the possibility and can
deal with it) or a huge misunderstanding over compile-time vs runtime
values.

I think it's a misunderstanding in may part. Let me explain my intention first. I want to retrieve the value (if isPointerTy() returns true) to be stored by a store instruction at run-time and pass on that value as either an unsigned int (64) or a pointer (char*) to an external function. The call to that function is inserted using IRBuilder.CreateCall().

Consider the code snippet below.

==================================================

if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
                    Value* vo = store_inst->getValueOperand();
                     uint64 var_value = /* cast vo to unsigned int 64 bit */

                   // Pass on this value to external function
                    IRBuilder<> builder(&I);
                    builder.SetInsertPoint(&B, ++builder.GetInsertPoint());
                    Constant *func = F.getParent()->getOrInsertFunction("instrument_store", 
                                                                  Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), NULL);
                    Value* args[] = {var_value};
                    builder.CreateCall(func, args);
 }

==================================================

To reiterate, I want to wrap up the run-time value (var_value) as a Value* and call the method (instrument_store) with that value as an argument.

 
If it's a nuisance, you can use "dyn_cast" instead of "cast". That'll
return nullptr if the store wasn't a constant instead of crashing; you
can decide what to do at that point.

Cheers.

Tim.



--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev





--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev


On 11 June 2017 at 18:22, don hinton <[hidden email]> wrote:
Sure, you can call store_inst->getOperand(0)->getType(), and call different functions based on the type, e.g., foo_8, foo_16, foo_32, etc...



You are dispatching call to different functions depending on if it's a LoadInst/StoreInst/CallInst. I am using a similar structure in my project, too. However, irrespective of the Type of the argument (i.e. i32/i32*/i32**), I just need its value (store_inst->getValueOperand() which is the same as store_inst->getOperand(0)). I want to ignore the type in this case. I feel there should be some unified means to deal all the cases in a single function. If I treat all the point values as uint64_t, that should solve the problem. But, I am scratching my head since last one day to figure out how to convince LLVM ignore the pointer type and just pass on its value as an unsigned, 64 bit integer.
 

On Sun, Jun 11, 2017 at 6:05 PM, Dipanjan Das via llvm-dev <[hidden email]> wrote:


On 11 June 2017 at 14:04, don hinton <[hidden email]> wrote:
Assuming you know it's a 64 bit value, and the function you are calling takes a uint64_t, try this:

The values from the test program are of type: i32/i32*/i32**. Can't I interpret these as uint64_t some way?
 

Value* args[] = {store_inst->getOperand(0)};


On Sun, Jun 11, 2017 at 1:16 PM, Dipanjan Das via llvm-dev <[hidden email]> wrote:


On 11 June 2017 at 12:05, Tim Northover <[hidden email]> wrote:
On 11 June 2017 at 11:56, Dipanjan Das via llvm-dev
<[hidden email]> wrote:
> I can't pass var_value to a function accepting uint64_t. LLVM complains
> about broken function call.

Well, yes. var_value has type "ConstantInt *", not uint64_t. Assuming
the value being stored actually is a constant known at compile-time
you should be able to use cast<ConstantInt *>(vo)->getZExtValue() to
retrieve a uint64_t value (careful of i128s!).

If that cast fails then you're not dealing with a constant store. This
is either a nuisance (if you were expecting the possibility and can
deal with it) or a huge misunderstanding over compile-time vs runtime
values.

I think it's a misunderstanding in may part. Let me explain my intention first. I want to retrieve the value (if isPointerTy() returns true) to be stored by a store instruction at run-time and pass on that value as either an unsigned int (64) or a pointer (char*) to an external function. The call to that function is inserted using IRBuilder.CreateCall().

Consider the code snippet below.

==================================================

if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
                    Value* vo = store_inst->getValueOperand();
                     uint64 var_value = /* cast vo to unsigned int 64 bit */

                   // Pass on this value to external function
                    IRBuilder<> builder(&I);
                    builder.SetInsertPoint(&B, ++builder.GetInsertPoint());
                    Constant *func = F.getParent()->getOrInsertFunction("instrument_store", 
                                                                  Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), NULL);
                    Value* args[] = {var_value};
                    builder.CreateCall(func, args);
 }

==================================================

To reiterate, I want to wrap up the run-time value (var_value) as a Value* and call the method (instrument_store) with that value as an argument.

 
If it's a nuisance, you can use "dyn_cast" instead of "cast". That'll
return nullptr if the store wasn't a constant instead of crashing; you
can decide what to do at that point.

Cheers.

Tim.



--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev





--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev





--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Force casting a Value*

Gerolf Hoflehner via llvm-dev
On 11 June 2017 at 18:36, Dipanjan Das via llvm-dev
<[hidden email]> wrote:
> You are dispatching call to different functions depending on if it's a
> LoadInst/StoreInst/CallInst. I am using a similar structure in my project,
> too. However, irrespective of the Type of the argument (i.e.
> i32/i32*/i32**), I just need its value (store_inst->getValueOperand() which
> is the same as store_inst->getOperand(0)).

Since you're after the runtime value you're going to have to convert
whatever you get to an i64 (and hope/verify that that's how a uint64_t
actually gets passed; a good bet, but not guaranteed).

So if you're storing a pointer you're going to have to insert a
ptrtoint instruction and then a call instruction using that result; if
you're storing an i32 you're going to have to insert a zext followed
by the call, etc. If you're storing an i128 or a 128-bit vector,
you're screwed.

> I want to ignore the type in this  case. I feel there should be some unified means to deal all the cases in a
> single function.

There isn't, because it's rarely actually useful; the type is
important. The closest thing is IRBuilder::CreateZExtOrTrunc which
will handle integer types in many cases, but not pointers or vectors
or structs or arrays or ...

Tim.
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev