summaryrefslogtreecommitdiff
path: root/lib/CodeGen/StackMaps.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2014-01-09 00:22:31 +0000
committerAndrew Trick <atrick@apple.com>2014-01-09 00:22:31 +0000
commitb3ea6d7ce7cdc3a7c5a49257cc28fdba56670d4f (patch)
treea54317962f5b932c18d6ad8d12534e296db4c282 /lib/CodeGen/StackMaps.cpp
parent07ef4fda1b02dcc9bda6cbf6665f2b76de5c13a8 (diff)
downloadllvm-b3ea6d7ce7cdc3a7c5a49257cc28fdba56670d4f.tar.gz
llvm-b3ea6d7ce7cdc3a7c5a49257cc28fdba56670d4f.tar.bz2
llvm-b3ea6d7ce7cdc3a7c5a49257cc28fdba56670d4f.tar.xz
llvm.experimental.stackmap: fix encoding of large constants.
In the stackmap format we advertise the constant field as signed. However, we were determining whether to promote to a 64-bit constant pool based on an unsigned comparison. This fix allows -1 to be encoded as a small constant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198816 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StackMaps.cpp')
-rw-r--r--lib/CodeGen/StackMaps.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/StackMaps.cpp b/lib/CodeGen/StackMaps.cpp
index 1dc76d5c6a..d70e6b3044 100644
--- a/lib/CodeGen/StackMaps.cpp
+++ b/lib/CodeGen/StackMaps.cpp
@@ -207,7 +207,10 @@ void StackMaps::recordStackMapOpers(const MachineInstr &MI, uint64_t ID,
// Move large constants into the constant pool.
for (LocationVec::iterator I = Locations.begin(), E = Locations.end();
I != E; ++I) {
- if (I->LocType == Location::Constant && (I->Offset & ~0xFFFFFFFFULL)) {
+ // Constants are encoded as sign-extended integers.
+ // -1 is directly encoded as .long 0xFFFFFFFF with no constant pool.
+ if (I->LocType == Location::Constant &&
+ ((I->Offset + (int64_t(1)<<31)) >> 32) != 0) {
I->LocType = Location::ConstantIndex;
I->Offset = ConstPool.getConstantIndex(I->Offset);
}