[llvm-commits] [llvm] r58623 - in /llvm/trunk: include/llvm/CodeGen/ValueTypes.h lib/VMCore/ValueTypes.cpp test/CodeGen/X86/i2k.ll utils/TableGen/CMakeLists.txt utils/TableGen/TGValueTypes.cpp
Dan Gohman
gohman at apple.com
Tue Nov 4 08:44:53 PST 2008
On Tue, November 4, 2008 1:38 am, Duncan Sands wrote:
>> there are no libcalls defined for very large integers so operations
>> like multiply and divide aren't supported.
>
> Here's a crazy idea. I hear that people are working on "libllvm",
> a reimplementation of libgcc. Maybe instead the code generator
> could be taught to generate library functions on the fly. For
> example, suppose a call to __udivsi3 is needed. Then the code
> generator creates the function __udivsi3 in the assembler, with
> weak linkage. Thanks to weak linkage there will be only one
> copy no matter how many object files it turns up in, and there
> is no need to link with libllvm. Now imagine that you need a
> similar library function to __udivsi3, but for i1024. Then you
> can have the code generators squirt out __udivsiXYZ!
This is a clever idea, though I agree with the other messages in
this thread.
>
>> This also introduces a minimal tablgen Type library, capable of
>> handling IntegerType and VectorType. This will allow parts of
>> TableGen that don't depend on using SimpleValueType values to handle
>> arbitrary integer and vector types.
>
> Are there any such parts? Or, rather, can such parts be changed
> to only use SimpleValueType?
The intrinsics handling.
>> /// isSimple - Test if the given MVT is simple (as opposed to being
>> /// extended).
>> bool isSimple() const {
>> - return V <= SimpleTypeMask;
>> + return V <= LastSimpleValueType;
>> }
>
> I see that you are confident that heap allocations never occur in the
> first 256 bytes of memory! :)
I added asserts to verify this assumption. If they ever fail for
someone, there are ways to fix this.
>> +unsigned MVT::getExtendedSizeInBits() const {
>> + assert(isExtended() && "Type is not extended!");
>> + if (const IntegerType *ITy = dyn_cast<IntegerType>(LLVMTy))
>> + return ITy->getBitWidth();
>> + if (const VectorType *VTy = dyn_cast<VectorType>(LLVMTy))
>> + return VTy->getBitWidth();
>> + assert(false && "Unrecognized extended type!");
>
> You probably want a return statement here so as not to get
> compiler warnings when assertions are turned off.
>> +}
Fixed.
>
> Finally, I notice that you didn't touch getTypeForMVT. For extended
> value types that function could be simplified to return LLVMTy.
Good idea. It's now done.
Thanks,
Dan
More information about the llvm-commits
mailing list