Determing C Types

What is the best way to determine the type of an arbitrary int? For example, find whether it is a char, short, int, long, long, etc?

So what I would like to do is redefine the widths for the types, making the type widths more portable and less target dependent, is this possible within llvm?

If what you're trying to do is use LLVM as a target-independent bitcode representation, you should be aware that it's not made for that purpose. In fact, it's specifically *not* target-independent, no matter what the types are.

For you initial question, you cannot map back from LLVM IR to C types, because the two have little to do with each other.

-bw

Bill,

Thanks, yes, I realize that’s not what it’s for; however, it looks like with a little tweaking it would be possible but I’d rather not change the LLVM base code. Guess I’ll just have to write my own code to do this, thanks.

Also, the initial question, so there’s no way to tell if int8 was a char in LLVM?

Thanks.

Chars don’t exist in LLVM. Clang may map char to be i8, but LLVM doesn’t know the difference.

Joey

Ok, thanks.