| Index: src/IceAssemblerX86BaseImpl.h
|
| diff --git a/src/IceAssemblerX86BaseImpl.h b/src/IceAssemblerX86BaseImpl.h
|
| index 912130a38a73346e3e7f57b8e8ef40b9e2d583b0..e20e950858b1feb6f9d872a61dd7037e176cff15 100644
|
| --- a/src/IceAssemblerX86BaseImpl.h
|
| +++ b/src/IceAssemblerX86BaseImpl.h
|
| @@ -152,6 +152,24 @@ void AssemblerX86Base<TraitsType>::pushl(GPRRegister reg) {
|
| }
|
|
|
| template <typename TraitsType>
|
| +void AssemblerX86Base<TraitsType>::pushl(const Immediate &Imm) {
|
| + AssemblerBuffer::EnsureCapacity ensured(&Buffer);
|
| + emitUint8(0x68);
|
| + emitInt32(Imm.value());
|
| +}
|
| +
|
| +template <typename TraitsType>
|
| +void AssemblerX86Base<TraitsType>::pushl(const ConstantRelocatable *Label) {
|
| + AssemblerBuffer::EnsureCapacity ensured(&Buffer);
|
| + intptr_t call_start = Buffer.getPosition();
|
| + emitUint8(0x68);
|
| + emitFixup(this->createFixup(Traits::FK_Abs, Label));
|
| + emitInt32(-4);
|
| + assert((Buffer.getPosition() - call_start) == kCallExternalLabelSize);
|
| + (void)call_start;
|
| +}
|
| +
|
| +template <typename TraitsType>
|
| void AssemblerX86Base<TraitsType>::popl(GPRRegister reg) {
|
| AssemblerBuffer::EnsureCapacity ensured(&Buffer);
|
| // Any type that would not force a REX prefix to be emitted can be provided
|
| @@ -382,7 +400,8 @@ template <typename TraitsType>
|
| void AssemblerX86Base<TraitsType>::lea(Type Ty, GPRRegister dst,
|
| const Address &src) {
|
| AssemblerBuffer::EnsureCapacity ensured(&Buffer);
|
| - assert(Ty == IceType_i16 || Ty == IceType_i32);
|
| + assert(Ty == IceType_i16 || Ty == IceType_i32 ||
|
| + (Traits::Is64Bit && Ty == IceType_i64));
|
| if (Ty == IceType_i16)
|
| emitOperandSizeOverride();
|
| emitAddrSizeOverridePrefix();
|
| @@ -3140,7 +3159,6 @@ void AssemblerX86Base<TraitsType>::jmp(Label *label, bool near) {
|
|
|
| template <typename TraitsType>
|
| void AssemblerX86Base<TraitsType>::jmp(const ConstantRelocatable *label) {
|
| - llvm::report_fatal_error("Untested - please verify and then reenable.");
|
| AssemblerBuffer::EnsureCapacity ensured(&Buffer);
|
| emitUint8(0xE9);
|
| emitFixup(this->createFixup(Traits::FK_PcRel, label));
|
| @@ -3308,21 +3326,22 @@ void AssemblerX86Base<TraitsType>::align(intptr_t alignment, intptr_t offset) {
|
|
|
| template <typename TraitsType>
|
| void AssemblerX86Base<TraitsType>::bind(Label *label) {
|
| - intptr_t bound = Buffer.size();
|
| + const intptr_t Bound = Buffer.size();
|
| assert(!label->isBound()); // Labels can only be bound once.
|
| while (label->isLinked()) {
|
| - intptr_t position = label->getLinkPosition();
|
| - intptr_t next = Buffer.load<int32_t>(position);
|
| - Buffer.store<int32_t>(position, bound - (position + 4));
|
| - label->Position = next;
|
| + const intptr_t Position = label->getLinkPosition();
|
| + const intptr_t Next = Buffer.load<int32_t>(Position);
|
| + const intptr_t Offset = Bound - (Position + 4);
|
| + Buffer.store<int32_t>(Position, Offset);
|
| + label->Position = Next;
|
| }
|
| while (label->hasNear()) {
|
| - intptr_t position = label->getNearPosition();
|
| - intptr_t offset = bound - (position + 1);
|
| - assert(Utils::IsInt(8, offset));
|
| - Buffer.store<int8_t>(position, offset);
|
| + intptr_t Position = label->getNearPosition();
|
| + const intptr_t Offset = Bound - (Position + 1);
|
| + assert(Utils::IsInt(8, Offset));
|
| + Buffer.store<int8_t>(Position, Offset);
|
| }
|
| - label->bindTo(bound);
|
| + label->bindTo(Bound);
|
| }
|
|
|
| template <typename TraitsType>
|
|
|