summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ConstantPools.cpp
diff options
context:
space:
mode:
authorDavid Peixotto <dpeixott@codeaurora.org>2014-07-18 16:05:14 +0000
committerDavid Peixotto <dpeixott@codeaurora.org>2014-07-18 16:05:14 +0000
commitae5ba76221c698bc8aed4dba72495d147fe42300 (patch)
treea6e7777784146fd6d1d380febd563d260933f83b /llvm/lib/MC/ConstantPools.cpp
parenta2347baaec37ba81d64f9b455af3084cf183f127 (diff)
downloadbcm5719-llvm-ae5ba76221c698bc8aed4dba72495d147fe42300.tar.gz
bcm5719-llvm-ae5ba76221c698bc8aed4dba72495d147fe42300.zip
MC: support different sized constants in constant pools
On AArch64 the pseudo instruction ldr <reg>, =... supports both 32-bit and 64-bit constants. Add support for 64 bit constants for the pools to support the pseudo instruction fully. Changes the AArch64 ldr-pseudo tests to use 32-bit registers and adds tests with 64-bit registers. Patch by Janne Grunau! Differential Revision: http://reviews.llvm.org/D4279 llvm-svn: 213387
Diffstat (limited to 'llvm/lib/MC/ConstantPools.cpp')
-rw-r--r--llvm/lib/MC/ConstantPools.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/lib/MC/ConstantPools.cpp b/llvm/lib/MC/ConstantPools.cpp
index f979dad47da..41ce68bfe0a 100644
--- a/llvm/lib/MC/ConstantPools.cpp
+++ b/llvm/lib/MC/ConstantPools.cpp
@@ -24,21 +24,22 @@ using namespace llvm;
void ConstantPool::emitEntries(MCStreamer &Streamer) {
if (Entries.empty())
return;
- Streamer.EmitCodeAlignment(4); // align to 4-byte address
Streamer.EmitDataRegion(MCDR_DataRegion);
for (EntryVecTy::const_iterator I = Entries.begin(), E = Entries.end();
I != E; ++I) {
- Streamer.EmitLabel(I->first);
- Streamer.EmitValue(I->second, 4);
+ Streamer.EmitCodeAlignment(I->Size); // align naturally
+ Streamer.EmitLabel(I->Label);
+ Streamer.EmitValue(I->Value, I->Size);
}
Streamer.EmitDataRegion(MCDR_DataRegionEnd);
Entries.clear();
}
-const MCExpr *ConstantPool::addEntry(const MCExpr *Value, MCContext &Context) {
+const MCExpr *ConstantPool::addEntry(const MCExpr *Value, MCContext &Context,
+ unsigned Size) {
MCSymbol *CPEntryLabel = Context.CreateTempSymbol();
- Entries.push_back(std::make_pair(CPEntryLabel, Value));
+ Entries.push_back( { CPEntryLabel, Value, Size } );
return MCSymbolRefExpr::Create(CPEntryLabel, Context);
}
@@ -89,7 +90,9 @@ void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
}
const MCExpr *AssemblerConstantPools::addEntry(MCStreamer &Streamer,
- const MCExpr *Expr) {
+ const MCExpr *Expr,
+ unsigned Size) {
const MCSection *Section = Streamer.getCurrentSection().first;
- return getOrCreateConstantPool(Section).addEntry(Expr, Streamer.getContext());
+ return getOrCreateConstantPool(Section).addEntry(Expr, Streamer.getContext(),
+ Size);
}
OpenPOWER on IntegriCloud