Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 695993004: Subzero: Switch to AT&T asm syntax. I give up. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add opcode suffix to xchg. Use .L$ prefix for constant pool entries. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceOperand.cpp ('k') | src/assembler_ia32.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index df7d04f591fb487293b29f8d21352219ce5112a5..6e25816eb8eba9172a0207814213b09bc51a487c 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -107,7 +107,7 @@ CondX86::BrCond getIcmp32Mapping(InstIcmp::ICond Cond) {
const struct TableTypeX8632Attributes_ {
Type InVectorElementType;
} TableTypeX8632Attributes[] = {
-#define X(tag, elementty, cvt, sdss, pack, width) \
+#define X(tag, elementty, cvt, sdss, pack, width, fld) \
{ elementty } \
,
ICETYPEX8632_TABLE
@@ -245,7 +245,7 @@ namespace dummy3 {
// Define a temporary set of enum values based on low-level table
// entries.
enum _tmp_enum {
-#define X(tag, elementty, cvt, sdss, pack, width) _tmp_##tag,
+#define X(tag, elementty, cvt, sdss, pack, width, fld) _tmp_##tag,
ICETYPEX8632_TABLE
#undef X
_num
@@ -257,7 +257,7 @@ ICETYPE_TABLE;
#undef X
// Define a set of constants based on low-level table entries, and
// ensure the table entry keys are consistent.
-#define X(tag, elementty, cvt, sdss, pack, width) \
+#define X(tag, elementty, cvt, sdss, pack, width, fld) \
static const int _table2_##tag = _tmp_##tag; \
static_assert(_table1_##tag == _table2_##tag, \
"Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE");
@@ -509,20 +509,16 @@ IceString TargetX8632::getRegName(SizeT RegNum, Type Ty) const {
void TargetX8632::emitVariable(const Variable *Var) const {
Ostream &Str = Ctx->getStrEmit();
if (Var->hasReg()) {
- Str << getRegName(Var->getRegNum(), Var->getType());
+ Str << "%" << getRegName(Var->getRegNum(), Var->getType());
return;
}
- Str << InstX8632::getWidthString(Var->getType());
- Str << " [" << getRegName(getFrameOrStackReg(), IceType_i32);
+ const Type Ty = IceType_i32;
int32_t Offset = Var->getStackOffset();
if (!hasFramePointer())
Offset += getStackAdjustment();
- if (Offset) {
- if (Offset > 0)
- Str << "+";
+ if (Offset)
Str << Offset;
- }
- Str << "]";
+ Str << "(%" << getRegName(getFrameOrStackReg(), Ty) << ")";
}
x86::Address TargetX8632::stackVarToAsmOperand(const Variable *Var) const {
@@ -995,7 +991,7 @@ template <typename T> void TargetX8632::emitConstantPool() const {
assert(CharsPrinted >= 0 &&
(size_t)CharsPrinted < llvm::array_lengthof(buf));
(void)CharsPrinted; // avoid warnings if asserts are disabled
- Str << "L$" << Ty << "$" << Const->getPoolEntryID() << ":\n";
+ Str << ".L$" << Ty << "$" << Const->getPoolEntryID() << ":\n";
Str << "\t" << T::AsmTag << "\t" << buf << "\t# " << T::TypeName << " "
<< Value << "\n";
}
@@ -4598,7 +4594,7 @@ void TargetX8632::postLower() {
template <> void ConstantInteger32::emit(GlobalContext *Ctx) const {
Ostream &Str = Ctx->getStrEmit();
- Str << (int32_t)getValue();
+ Str << "$" << (int32_t)getValue();
}
template <> void ConstantInteger64::emit(GlobalContext *) const {
@@ -4607,14 +4603,12 @@ template <> void ConstantInteger64::emit(GlobalContext *) const {
template <> void ConstantFloat::emit(GlobalContext *Ctx) const {
Ostream &Str = Ctx->getStrEmit();
- // It would be better to prefix with ".L$" instead of "L$", but
- // llvm-mc doesn't parse "dword ptr [.L$foo]".
- Str << "dword ptr [L$" << IceType_f32 << "$" << getPoolEntryID() << "]";
+ Str << ".L$" << IceType_f32 << "$" << getPoolEntryID();
}
template <> void ConstantDouble::emit(GlobalContext *Ctx) const {
Ostream &Str = Ctx->getStrEmit();
- Str << "qword ptr [L$" << IceType_f64 << "$" << getPoolEntryID() << "]";
+ Str << ".L$" << IceType_f64 << "$" << getPoolEntryID();
}
void ConstantUndef::emit(GlobalContext *) const {
« no previous file with comments | « src/IceOperand.cpp ('k') | src/assembler_ia32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698