Exemplo n.º 1
0
// Encase the Bitcode in a wrapper containing RS version information.
void Backend::WrapBitcode(llvm::raw_string_ostream &Bitcode) {
  bcinfo::AndroidBitcodeWrapper wrapper;
  size_t actualWrapperLen = bcinfo::writeAndroidBitcodeWrapper(
      &wrapper, Bitcode.str().length(), getTargetAPI(),
      SlangVersion::CURRENT, mCodeGenOpts.OptimizationLevel);

  slangAssert(actualWrapperLen > 0);

  // Write out the bitcode wrapper.
  FormattedOutStream.write(reinterpret_cast<char*>(&wrapper), actualWrapperLen);

  // Write out the actual encoded bitcode.
  FormattedOutStream << Bitcode.str();
}
Exemplo n.º 2
0
// Encase the Bitcode in a wrapper containing RS version information.
void Backend::WrapBitcode(llvm::raw_string_ostream &Bitcode) {
    struct bcinfo::BCWrapperHeader header;
    header.Magic = 0x0B17C0DE;
    header.Version = 0;
    header.BitcodeOffset = sizeof(header);
    header.BitcodeSize = Bitcode.str().length();
    header.HeaderVersion = 0;
    header.TargetAPI = getTargetAPI();

    // Write out the bitcode wrapper.
    FormattedOutStream.write((const char*) &header, sizeof(header));

    // Write out the actual encoded bitcode.
    FormattedOutStream << Bitcode.str();
    return;
}