Skip to content

Handle Floating Point Constant Data Sequentials #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions lib/Target/CBackend/CBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ namespace {
void printContainedStructs(Type *Ty, SmallPtrSet<Type *, 16> &);
void printFloatingPointConstants(Function &F);
void printFloatingPointConstants(const Constant *C);
void
printFloatingPointConstantDataSequentials(const ConstantDataSequential *CDS);
void printFunctionSignature(const Function *F, bool Prototype);
bool okayToPrint(BasicBlock *BB);
void printFunction(Function &);
Expand Down Expand Up @@ -2184,8 +2186,13 @@ void CWriter::printFloatingPointConstants(Function &F) {
// precision.
//
for (constant_iterator I = constant_begin(&F), E = constant_end(&F);
I != E; ++I)
printFloatingPointConstants(*I);
I != E; ++I) {
if (const ConstantDataSequential *CDS = dyn_cast<ConstantDataSequential>(*I)) {
printFloatingPointConstantDataSequentials(CDS);
} else {
printFloatingPointConstants(*I);
}
}

Out << '\n';
}
Expand Down Expand Up @@ -2244,6 +2251,12 @@ void CWriter::printFloatingPointConstants(const Constant *C) {
}
}

void CWriter::printFloatingPointConstantDataSequentials(
const ConstantDataSequential *CDS) {
for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
printFloatingPointConstants(CDS->getElementAsConstant(i));
}
}

/// printSymbolTable - Run through symbol table looking for type names. If a
/// type name is found, emit its declaration...
Expand Down