diff options
author | Sjoerd Meijer <sjoerd.meijer@arm.com> | 2018-02-13 15:34:09 +0000 |
---|---|---|
committer | Sjoerd Meijer <sjoerd.meijer@arm.com> | 2018-02-13 15:34:09 +0000 |
commit | f4a7fa7bbef6ba0fabd9de99eb18ffa5f12b624f (patch) | |
tree | e9b1fddabaee9dc32e32283c7b5a213c434b39c7 /llvm/lib/Target/ARM/ARMConstantIslandPass.cpp | |
parent | bb295e0d9b9ea448b73fa8dde8ec385e3b3eb38e (diff) | |
download | bcm5719-llvm-f4a7fa7bbef6ba0fabd9de99eb18ffa5f12b624f.tar.gz bcm5719-llvm-f4a7fa7bbef6ba0fabd9de99eb18ffa5f12b624f.zip |
[ARM] Allow half types in ConstantPool
Change ARMConstantIslandPass to:
- accept f16 literals as litpool entries,
- if the litpool needs to be inserted in the middle of a big block, then we
need to 4-byte align the next instruction in ARM mode.
Differential Revision: https://reviews.llvm.org/D42784
llvm-svn: 325012
Diffstat (limited to 'llvm/lib/Target/ARM/ARMConstantIslandPass.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMConstantIslandPass.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp index 8baee1ce281..32c88bca186 100644 --- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp +++ b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp @@ -510,7 +510,6 @@ ARMConstantIslands::doInitialConstPlacement(std::vector<MachineInstr*> &CPEMIs) const DataLayout &TD = MF->getDataLayout(); for (unsigned i = 0, e = CPs.size(); i != e; ++i) { unsigned Size = TD.getTypeAllocSize(CPs[i].getType()); - assert(Size >= 4 && "Too small constant pool entry"); unsigned Align = CPs[i].getAlignment(); assert(isPowerOf2_32(Align) && "Invalid alignment"); // Verify that all constant pool entries are a multiple of their alignment. @@ -820,6 +819,11 @@ initializeFunctionInfo(const std::vector<MachineInstr*> &CPEMIs) { Scale = 4; // +-(offset_8*4) NegOk = true; break; + case ARM::VLDRH: + Bits = 8; + Scale = 2; // +-(offset_8*2) + NegOk = true; + break; case ARM::tLDRHi: Bits = 5; @@ -1421,6 +1425,10 @@ void ARMConstantIslands::createNewWater(unsigned CPUserIndex, assert(!isThumb || getITInstrPredicate(*MI, PredReg) == ARMCC::AL)); NewMBB = splitBlockBeforeInstr(&*MI); + + // 4 byte align the next block after the constant pool when the CPE is a + // 16-bit value in ARM mode, and 2 byte for Thumb. + NewMBB->setAlignment(isThumb ? 1 : 2); } /// handleConstantPoolUser - Analyze the specified user, checking to see if it |