} while (Value);
}
-/// SizeULEB128 - Compute the number of bytes required for an unsigned leb128
-/// value.
-unsigned AsmPrinter::SizeULEB128(unsigned Value) {
- unsigned Size = 0;
- do {
- Value >>= 7;
- Size += sizeof(int8_t);
- } while (Value);
- return Size;
-}
-
/// PrintSLEB128 - Print a series of hexidecimal values (separated by commas)
/// representing a signed leb128 value.
void AsmPrinter::PrintSLEB128(int Value) const {
int Sign = Value >> (8 * sizeof(Value) - 1);
bool IsMore;
-
+
do {
unsigned Byte = Value & 0x7f;
Value >>= 7;
} while (IsMore);
}
-/// SizeSLEB128 - Compute the number of bytes required for a signed leb128
-/// value.
-unsigned AsmPrinter::SizeSLEB128(int Value) {
- unsigned Size = 0;
- int Sign = Value >> (8 * sizeof(Value) - 1);
- bool IsMore;
-
- do {
- unsigned Byte = Value & 0x7f;
- Value >>= 7;
- IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
- Size += sizeof(int8_t);
- } while (IsMore);
- return Size;
-}
-
//===--------------------------------------------------------------------===//
// Emission and print routines
//
// We can emit the pointer value into this slot if the slot is an
// integer slot greater or equal to the size of the pointer.
- if (Ty->isInteger() &&
- TD->getABITypeSize(Ty) >= TD->getABITypeSize(Op->getType()))
+ if (TD->getABITypeSize(Ty) >= TD->getABITypeSize(Op->getType()))
return EmitConstantValueOnly(Op);
-
- assert(0 && "FIXME: Don't yet support this kind of constant cast expr");
+
+ O << "((";
EmitConstantValueOnly(Op);
+ APInt ptrMask = APInt::getAllOnesValue(TD->getABITypeSizeInBits(Ty));
+ O << ") & " << ptrMask.toStringUnsigned() << ')';
break;
}
case Instruction::Add:
void AsmPrinter::printSuffixedName(const std::string &Name, const char* Suffix) {
printSuffixedName(Name.c_str(), Suffix);
}
+
+void AsmPrinter::printVisibility(const std::string& Name,
+ unsigned Visibility) const {
+ if (Visibility == GlobalValue::HiddenVisibility) {
+ if (const char *Directive = TAI->getHiddenDirective())
+ O << Directive << Name << '\n';
+ } else if (Visibility == GlobalValue::ProtectedVisibility) {
+ if (const char *Directive = TAI->getProtectedDirective())
+ O << Directive << Name << '\n';
+ }
+}