summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-02-11 11:09:23 +0000
committerDuncan Sands <baldrick@free.fr>2008-02-11 11:09:23 +0000
commit04feb51886805046e8b1af10b7d21bc1ef85f457 (patch)
tree922a9a821aa9a3ca4d91c48306de0a1492db8d35 /include/llvm
parente3320a1bcce3f6653e109cc86ee1011b0a61d808 (diff)
downloadllvm-04feb51886805046e8b1af10b7d21bc1ef85f457.tar.gz
llvm-04feb51886805046e8b1af10b7d21bc1ef85f457.tar.bz2
llvm-04feb51886805046e8b1af10b7d21bc1ef85f457.tar.xz
Add arbitrary integer support to getRegisterType and
getNumRegisters. This is needed for calling functions with apint parameters or return values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46956 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Target/TargetLowering.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 947a1d67a8..ee3b27246e 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -434,13 +434,18 @@ public:
(void)getVectorTypeBreakdown(VT, VT1, NumIntermediates, RegisterVT);
return RegisterVT;
}
+ if (MVT::isInteger(VT)) {
+ return getRegisterType(getTypeToTransformTo(VT));
+ }
assert(0 && "Unsupported extended type!");
}
/// getNumRegisters - Return the number of registers that this ValueType will
/// eventually require. This is one for any types promoted to live in larger
/// registers, but may be more than one for types (like i64) that are split
- /// into pieces.
+ /// into pieces. For types like i140, which are first promoted then expanded,
+ /// it is the number of registers needed to hold all the bits of the original
+ /// type. For an i140 on a 32 bit machine this means 5 registers.
unsigned getNumRegisters(MVT::ValueType VT) const {
if (!MVT::isExtendedVT(VT)) {
assert(VT < array_lengthof(NumRegistersForVT));
@@ -451,6 +456,11 @@ public:
unsigned NumIntermediates;
return getVectorTypeBreakdown(VT, VT1, NumIntermediates, VT2);
}
+ if (MVT::isInteger(VT)) {
+ unsigned BitWidth = MVT::getSizeInBits(VT);
+ unsigned RegWidth = MVT::getSizeInBits(getRegisterType(VT));
+ return (BitWidth + RegWidth - 1) / RegWidth;
+ }
assert(0 && "Unsupported extended type!");
}