[llvm-branch-commits] [llvm-branch] r119216 - in /llvm/branches/Apple/whitney: lib/Target/ARM/ARMInstrThumb.td lib/Target/ARM/ARMInstrThumb2.td lib/Target/X86/X86InstrCompiler.td lib/Target/X86/X86InstrExtension.td utils/TableGen/AsmMatcherEmitter.cpp
Daniel Dunbar
daniel at zuster.org
Mon Nov 15 13:44:07 PST 2010
Author: ddunbar
Date: Mon Nov 15 15:44:06 2010
New Revision: 119216
URL: http://llvm.org/viewvc/llvm-project?rev=119216&view=rev
Log:
Merge r117861:
--
Author: Chris Lattner <clattner at apple.com>
Date: Sun Oct 31 19:15:18 2010 +0000
two changes: make the asmmatcher generator ignore ARM pseudos properly,
and make it a hard error for instructions to not have an asm string.
These instructions should be marked isCodeGenOnly.
Modified:
llvm/branches/Apple/whitney/lib/Target/ARM/ARMInstrThumb.td
llvm/branches/Apple/whitney/lib/Target/ARM/ARMInstrThumb2.td
llvm/branches/Apple/whitney/lib/Target/X86/X86InstrCompiler.td
llvm/branches/Apple/whitney/lib/Target/X86/X86InstrExtension.td
llvm/branches/Apple/whitney/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/branches/Apple/whitney/lib/Target/ARM/ARMInstrThumb.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Target/ARM/ARMInstrThumb.td?rev=119216&r1=119215&r2=119216&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Target/ARM/ARMInstrThumb.td (original)
+++ llvm/branches/Apple/whitney/lib/Target/ARM/ARMInstrThumb.td Mon Nov 15 15:44:06 2010
@@ -205,7 +205,7 @@
T1Misc<0b0110011>;
// For both thumb1 and thumb2.
-let isNotDuplicable = 1 in
+let isNotDuplicable = 1, isCodeGenOnly = 1 in
def tPICADD : TIt<(outs GPR:$dst), (ins GPR:$lhs, pclabel:$cp), IIC_iALUr, "",
[(set GPR:$dst, (ARMpic_add GPR:$lhs, imm:$cp))]>,
T1Special<{0,0,?,?}> {
@@ -917,14 +917,14 @@
// $val is a scratch register for our use.
let Defs =
[ R0, R1, R2, R3, R4, R5, R6, R7, R12 ], hasSideEffects = 1,
- isBarrier = 1 in {
+ isBarrier = 1, isCodeGenOnly = 1 in {
def tInt_eh_sjlj_setjmp : ThumbXI<(outs),(ins tGPR:$src, tGPR:$val),
AddrModeNone, SizeSpecial, NoItinerary, "", "",
[(set R0, (ARMeh_sjlj_setjmp tGPR:$src, tGPR:$val))]>;
}
// FIXME: Non-Darwin version(s)
-let isBarrier = 1, hasSideEffects = 1, isTerminator = 1,
+let isBarrier = 1, hasSideEffects = 1, isTerminator = 1, isCodeGenOnly = 1,
Defs = [ R7, LR, SP ] in {
def tInt_eh_sjlj_longjmp : XI<(outs), (ins GPR:$src, GPR:$scratch),
AddrModeNone, SizeSpecial, IndexModeNone,
Modified: llvm/branches/Apple/whitney/lib/Target/ARM/ARMInstrThumb2.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Target/ARM/ARMInstrThumb2.td?rev=119216&r1=119215&r2=119216&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Target/ARM/ARMInstrThumb2.td (original)
+++ llvm/branches/Apple/whitney/lib/Target/ARM/ARMInstrThumb2.td Mon Nov 15 15:44:06 2010
@@ -2454,7 +2454,7 @@
[ R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, LR, D0,
D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15,
D16, D17, D18, D19, D20, D21, D22, D23, D24, D25, D26, D27, D28, D29, D30,
- D31 ], hasSideEffects = 1, isBarrier = 1 in {
+ D31 ], hasSideEffects = 1, isBarrier = 1, isCodeGenOnly = 1 in {
def t2Int_eh_sjlj_setjmp : Thumb2XI<(outs), (ins tGPR:$src, tGPR:$val),
AddrModeNone, SizeSpecial, NoItinerary, "", "",
[(set R0, (ARMeh_sjlj_setjmp tGPR:$src, tGPR:$val))]>,
@@ -2463,7 +2463,7 @@
let Defs =
[ R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, LR ],
- hasSideEffects = 1, isBarrier = 1 in {
+ hasSideEffects = 1, isBarrier = 1, isCodeGenOnly = 1 in {
def t2Int_eh_sjlj_setjmp_nofp : Thumb2XI<(outs), (ins tGPR:$src, tGPR:$val),
AddrModeNone, SizeSpecial, NoItinerary, "", "",
[(set R0, (ARMeh_sjlj_setjmp tGPR:$src, tGPR:$val))]>,
Modified: llvm/branches/Apple/whitney/lib/Target/X86/X86InstrCompiler.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Target/X86/X86InstrCompiler.td?rev=119216&r1=119215&r2=119216&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Target/X86/X86InstrCompiler.td (original)
+++ llvm/branches/Apple/whitney/lib/Target/X86/X86InstrCompiler.td Mon Nov 15 15:44:06 2010
@@ -161,7 +161,7 @@
// instruction is lowered to an MCInst.
// FIXME: AddedComplexity gives this a higher priority than MOV64ri32. Remove
// when we have a better way to specify isel priority.
-let Defs = [EFLAGS],
+let Defs = [EFLAGS], isCodeGenOnly=1,
AddedComplexity = 1, isReMaterializable = 1, isAsCheapAsAMove = 1 in
def MOV64r0 : I<0x31, MRMInitReg, (outs GR64:$dst), (ins), "",
[(set GR64:$dst, 0)]>;
@@ -169,11 +169,11 @@
// Materialize i64 constant where top 32-bits are zero. This could theoretically
// use MOV32ri with a SUBREG_TO_REG to represent the zero-extension, however
// that would make it more difficult to rematerialize.
-let AddedComplexity = 1, isReMaterializable = 1, isAsCheapAsAMove = 1 in
+let AddedComplexity = 1, isReMaterializable = 1, isAsCheapAsAMove = 1,
+ isCodeGenOnly = 1 in
def MOV64ri64i32 : Ii32<0xB8, AddRegFrm, (outs GR64:$dst), (ins i64i32imm:$src),
"", [(set GR64:$dst, i64immZExt32:$src)]>;
-
// Use sbb to materialize carry bit.
let Uses = [EFLAGS], Defs = [EFLAGS], isCodeGenOnly = 1 in {
// FIXME: These are pseudo ops that should be replaced with Pat<> patterns.
Modified: llvm/branches/Apple/whitney/lib/Target/X86/X86InstrExtension.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Target/X86/X86InstrExtension.td?rev=119216&r1=119215&r2=119216&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Target/X86/X86InstrExtension.td (original)
+++ llvm/branches/Apple/whitney/lib/Target/X86/X86InstrExtension.td Mon Nov 15 15:44:06 2010
@@ -45,10 +45,14 @@
"movs{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
def MOVSX16rm8W : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem:$src),
"movs{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
+
+// FIXME: Use a pat pattern or define a syntax here.
+let isCodeGenOnly=1 in {
def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
"", [(set GR16:$dst, (sext GR8:$src))]>, TB;
def MOVSX16rm8 : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
"", [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB;
+}
def MOVSX32rr8 : I<0xBE, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
"movs{bl|x}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, (sext GR8:$src))]>, TB;
@@ -69,10 +73,13 @@
"movz{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
def MOVZX16rm8W : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem:$src),
"movz{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
+// FIXME: Use a pat pattern or define a syntax here.
+let isCodeGenOnly=1 in {
def MOVZX16rr8 : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
"", [(set GR16:$dst, (zext GR8:$src))]>, TB;
def MOVZX16rm8 : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
"", [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB;
+}
def MOVZX32rr8 : I<0xB6, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
"movz{bl|x}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, (zext GR8:$src))]>, TB;
@@ -132,6 +139,9 @@
def MOVZX64rm16_Q : RI<0xB7, MRMSrcMem, (outs GR64:$dst), (ins i16mem:$src),
"movz{wq|x}\t{$src, $dst|$dst, $src}", []>, TB;
+// FIXME: These should be Pat patterns.
+let isCodeGenOnly = 1 in {
+
// Use movzbl instead of movzbq when the destination is a register; it's
// equivalent due to implicit zero-extending, and it has a smaller encoding.
def MOVZX64rr8 : I<0xB6, MRMSrcReg, (outs GR64:$dst), (ins GR8 :$src),
@@ -158,5 +168,5 @@
"", [(set GR64:$dst, (zextloadi64i32 addr:$src))]>;
-
+}
Modified: llvm/branches/Apple/whitney/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/utils/TableGen/AsmMatcherEmitter.cpp?rev=119216&r1=119215&r2=119216&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/branches/Apple/whitney/utils/TableGen/AsmMatcherEmitter.cpp Mon Nov 15 15:44:06 2010
@@ -225,11 +225,18 @@
// Ignore pseudo ops.
//
- // FIXME: This is a hack; can we convert these instructions to set the
- // "codegen only" bit instead?
+ // FIXME: This is a hack [for X86]; can we convert these instructions to set
+ // the "codegen only" bit instead?
if (const RecordVal *Form = CGI.TheDef->getValue("Form"))
if (Form->getValue()->getAsString() == "Pseudo")
return false;
+
+ // FIXME: This is a hack [for ARM]; can we convert these instructions to set
+ // the "codegen only" bit instead?
+ if (const RecordVal *Form = CGI.TheDef->getValue("F"))
+ if (Form->getValue()->getAsString() == "Pseudo")
+ return false;
+
// Ignore "Int_*" and "*_Int" instructions, which are internal aliases.
//
@@ -240,18 +247,19 @@
// Ignore instructions with no .s string.
//
// FIXME: What are these?
- if (CGI.AsmString.empty())
- return false;
+ if (CGI.AsmString.empty()) {
+ PrintError(CGI.TheDef->getLoc(),
+ "instruction with empty asm string");
+ throw std::string("ERROR: Invalid instruction for asm matcher");
+ }
// FIXME: Hack; ignore any instructions with a newline in them.
if (std::find(CGI.AsmString.begin(),
CGI.AsmString.end(), '\n') != CGI.AsmString.end())
return false;
- // Ignore instructions with attributes, these are always fake instructions for
- // simplifying codegen.
- //
- // FIXME: Is this true?
+ // Reject instructions with attributes, these aren't something we can handle,
+ // the target should be refactored to use operands instead of modifiers.
//
// Also, check for instructions which reference the operand multiple times;
// this implies a constraint we would not honor.
More information about the llvm-branch-commits
mailing list