Chromium Code Reviews| Index: src/IceELFObjectWriter.cpp |
| diff --git a/src/IceELFObjectWriter.cpp b/src/IceELFObjectWriter.cpp |
| index 9c75482def48ede32edf4d4d097cd5b04e14e768..25138367e32c3ca98e240c68605e6beaca415cfe 100644 |
| --- a/src/IceELFObjectWriter.cpp |
| +++ b/src/IceELFObjectWriter.cpp |
| @@ -383,8 +383,9 @@ void ELFObjectWriter::writeDataOfType(SectionType ST, |
| for (VariableDeclaration::Initializer *Init : Var->getInitializers()) { |
| switch (Init->getKind()) { |
| case VariableDeclaration::Initializer::DataInitializerKind: { |
| - const auto Data = llvm::cast<VariableDeclaration::DataInitializer>( |
| - Init)->getContents(); |
| + const auto Data = |
| + llvm::cast<VariableDeclaration::DataInitializer>(Init) |
| + ->getContents(); |
| Section->appendData(Str, llvm::StringRef(Data.data(), Data.size())); |
| break; |
| } |
| @@ -504,6 +505,12 @@ template <typename ConstType> void ELFObjectWriter::writeConstantPool(Type Ty) { |
| // Write the data. |
| for (Constant *C : Pool) { |
| auto Const = llvm::cast<ConstType>(C); |
| + // When constant pooling turned on, only emit labels for eligible constants |
|
Jim Stichnoth
2015/06/12 23:48:17
end sentence with period
qining
2015/06/17 04:28:53
Done.
|
| + // If C is i32 constant and not large enough, we should ignore it here. |
| + if (llvm::isa<ConstantInteger32>(C) && |
|
Jim Stichnoth
2015/06/12 23:48:17
Normally this kind of type checking would be done
qining
2015/06/17 04:28:53
I have moved shouldBeRandomizedOrPooled() to class
|
| + llvm::dyn_cast_or_null<ConstantInteger32>(C) |
| + ->shouldBeRandomizedOrPooled(&Ctx) == false) |
|
Jim Stichnoth
2015/06/12 23:48:17
use "!x" instead of "x==false"
qining
2015/06/17 04:28:53
Done.
|
| + continue; |
| std::string SymBuffer; |
| llvm::raw_string_ostream SymStrBuf(SymBuffer); |
| Const->emitPoolLabel(SymStrBuf); |
| @@ -528,6 +535,8 @@ template void ELFObjectWriter::writeConstantPool<ConstantFloat>(Type Ty); |
| template void ELFObjectWriter::writeConstantPool<ConstantDouble>(Type Ty); |
| +template void ELFObjectWriter::writeConstantPool<ConstantInteger32>(Type Ty); |
| + |
| void ELFObjectWriter::writeAllRelocationSections() { |
| writeRelocationSections(RelTextSections); |
| writeRelocationSections(RelDataSections); |