#include "llvm/Support/CFG.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/MathExtras.h"
#include <algorithm>
using namespace llvm;
namespace llvm {
+// Make virtual table appear in this compilation unit.
+AssemblyAnnotationWriter::~AssemblyAnnotationWriter() {}
+
/// This class provides computation of slot numbers for LLVM Assembly writing.
/// @brief LLVM Assembly Writing Slot Computation.
class SlotMachine {
// Otherwise we could not reparse it to exactly the same value, so we must
// output the string in hexadecimal format!
- //
- // Behave nicely in the face of C TBAA rules... see:
- // http://www.nullstone.com/htmls/category/aliastyp.htm
- //
- union {
- double D;
- uint64_t U;
- } V;
- V.D = CFP->getValue();
assert(sizeof(double) == sizeof(uint64_t) &&
"assuming that double is 64 bits!");
- Out << "0x" << utohexstr(V.U);
+ Out << "0x" << utohexstr(DoubleToBits(CFP->getValue()));
} else if (isa<ConstantAggregateZero>(CV)) {
Out << "zeroinitializer";
assert(C && "GlobalVar initializer isn't constant?");
writeOperand(GV->getInitializer(), false, isa<GlobalValue>(C));
}
-
+
+ if (GV->hasSection())
+ Out << ", section \"" << GV->getSection() << '"';
+ if (GV->getAlignment())
+ Out << ", align " << GV->getAlignment();
+
printInfoComment(*GV);
Out << "\n";
}
}
Out << ')';
+ if (F->hasSection())
+ Out << " section \"" << F->getSection() << '"';
+ if (F->getAlignment())
+ Out << " align " << F->getAlignment();
+
if (F->isExternal()) {
Out << "\n";
} else {
Out << ',';
writeOperand(AI->getArraySize(), true);
}
+ if (AI->getAlignment()) {
+ Out << ", align " << AI->getAlignment();
+ }
} else if (isa<CastInst>(I)) {
if (Operand) writeOperand(Operand, true); // Work with broken code
Out << " to ";
if (Operand) writeOperand(Operand, true); // Work with broken code
Out << ", ";
printType(I.getType());
- } else if (const VANextInst *VAN = dyn_cast<VANextInst>(&I)) {
- if (Operand) writeOperand(Operand, true); // Work with broken code
- Out << ", ";
- printType(VAN->getArgType());
} else if (Operand) { // Print the normal way...
// PrintAllTypes - Instructions who have operands of all the same type