Move [SU]LEB128 encoding to a utility header.

These functions are very generic. There's no reason for them to
be tied to MCObjectWriter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161545 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach
2012-08-08 23:56:06 +00:00
parent fdd6484b41
commit 2d39a0e52d
6 changed files with 68 additions and 46 deletions

View File

@@ -27,6 +27,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/LEB128.h"
using namespace llvm;
@@ -713,9 +714,9 @@ bool MCAssembler::relaxLEB(MCAsmLayout &Layout, MCLEBFragment &LF) {
Data.clear();
raw_svector_ostream OSE(Data);
if (LF.isSigned())
MCObjectWriter::EncodeSLEB128(Value, OSE);
encodeSLEB128(Value, OSE);
else
MCObjectWriter::EncodeULEB128(Value, OSE);
encodeULEB128(Value, OSE);
OSE.flush();
return OldSize != LF.getContents().size();
}