Index: src/IceAssemblerX86BaseImpl.h |
diff --git a/src/IceAssemblerX86BaseImpl.h b/src/IceAssemblerX86BaseImpl.h |
index 912130a38a73346e3e7f57b8e8ef40b9e2d583b0..231e69e3b7d2df0b6bced22f42de5044c4079f9e 100644 |
--- a/src/IceAssemblerX86BaseImpl.h |
+++ b/src/IceAssemblerX86BaseImpl.h |
@@ -152,6 +152,28 @@ 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(); |
Jim Stichnoth
2016/01/14 00:09:52
CallStart
John
2016/01/14 23:18:25
Well, this is no longer needed, so I removed it.
|
+ emitUint8(0x68); |
+ emitFixup(this->createFixup(Traits::FK_Abs, Label)); |
+ // In x86-32, the emitted value is an addend to the relocation. Therefore, |
Jim Stichnoth
2016/01/14 00:09:52
Reflow to 80-col, I think
John
2016/01/14 23:18:25
Done.
|
+ // we must emit a 0 (because we're pushing an absolute relocation.) |
+ // In x86-64, the emitted value does not matter (the addend lives in the |
+ // relocation record as an extra field.) |
+ emitInt32(0); |
+ 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 +404,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 +3163,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 +3330,22 @@ void AssemblerX86Base<TraitsType>::align(intptr_t alignment, intptr_t offset) { |
template <typename TraitsType> |
void AssemblerX86Base<TraitsType>::bind(Label *label) { |
Jim Stichnoth
2016/01/14 00:09:52
label==>Label while you're at it...
John
2016/01/14 23:18:25
Label is the type name. The code looks very confus
|
- 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> |