llvm-6502/lib/CodeGen/SelectionDAG
Hal Finkel 6809724935 [InlineAsm] Remove EarlyClobber on registers that are also inputs
When an inline asm call has an output register marked as early-clobber, but
that same register is also an input operand, what should we do? GCC accepts
this, and is documented to accept this for read/write operands saying,
"Furthermore, if the earlyclobber operand is also a read/write operand, then
that operand is written only after it's used." For write-only operands, the
situation seems less clear, but I have at least one existing codebase that
assumes this will work, in part because it has syscall macros like this:

({                                                                         \
  register uint64_t r0 __asm__ ("r0") = (__NR_ ## name);                   \
  register uint64_t r3 __asm__ ("r3") = ((uint64_t) (arg0));               \
  register uint64_t r4 __asm__ ("r4") = ((uint64_t) (arg1));               \
  register uint64_t r5 __asm__ ("r5") = ((uint64_t) (arg2));               \
  __asm__ __volatile__                                                     \
  ("sc"                                                                    \
   : "=&r"(r0),"=&r"(r3),"=&r"(r4),"=&r"(r5)                               \
   :   "0"(r0),  "1"(r3),  "2"(r4),  "3"(r5)                               \
   : "r6","r7","r8","r9","r10","r11","r12","cr0","memory");                \
  r3;                                                                      \
})

Furthermore, with register aliases and subregister relationships that only the
backend knows about, rejecting this in the frontend seems like a difficult
proposition (if we wanted to do so). However, keeping the early-clobber flag on
the INLINEASM MI does not work for us, because it will cause the register's
live interval to end to soon (so it will not appear defined to be used as an
input).

Fortunately, fixing this does not seem hard: When forming the INLINEASM MI,
check to see if any of the early-clobber outputs are also inputs, and if so,
remove the early-clobber flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235283 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-20 00:01:30 +00:00
..
CMakeLists.txt
DAGCombiner.cpp Add support to promote f16 to f32 2015-04-17 18:36:25 +00:00
FastISel.cpp CodeGen: Stop using DIDescriptor::is*() and auto-casting 2015-04-06 23:27:40 +00:00
FunctionLoweringInfo.cpp Revert r235154-r235156, they cause asserts when building win64 code (http://crbug.com/477988) 2015-04-17 09:10:43 +00:00
InstrEmitter.cpp [InlineAsm] Remove EarlyClobber on registers that are also inputs 2015-04-20 00:01:30 +00:00
InstrEmitter.h
LegalizeDAG.cpp [AArch64] Promote f16 operations to f32. 2015-04-10 00:08:48 +00:00
LegalizeFloatTypes.cpp Fix build errors introduced by r235215 2015-04-17 19:51:44 +00:00
LegalizeIntegerTypes.cpp Add support to promote f16 to f32 2015-04-17 18:36:25 +00:00
LegalizeTypes.cpp Add support to promote f16 to f32 2015-04-17 18:36:25 +00:00
LegalizeTypes.h Add support to promote f16 to f32 2015-04-17 18:36:25 +00:00
LegalizeTypesGeneric.cpp Fix build errors introduced by r235215 2015-04-17 19:51:44 +00:00
LegalizeVectorOps.cpp fix typo and 80-col; NFC 2015-03-27 21:45:18 +00:00
LegalizeVectorTypes.cpp Fix build errors introduced by r235215 2015-04-17 19:51:44 +00:00
LLVMBuild.txt
Makefile
ResourcePriorityQueue.cpp
ScheduleDAGFast.cpp
ScheduleDAGRRList.cpp Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
ScheduleDAGSDNodes.cpp
ScheduleDAGSDNodes.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
ScheduleDAGVLIW.cpp Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
SDNodeDbgValue.h
SelectionDAG.cpp TRUNCATE constant folding - minor fix for rL233224 2015-04-16 08:21:09 +00:00
SelectionDAGBuilder.cpp Revert the switch lowering change (r235101, r235103, r235106) 2015-04-16 15:43:26 +00:00
SelectionDAGBuilder.h Revert the switch lowering change (r235101, r235103, r235106) 2015-04-16 15:43:26 +00:00
SelectionDAGDumper.cpp DebugInfo: Gut DIScope, DIEnumerator and DISubrange 2015-04-16 01:37:00 +00:00
SelectionDAGISel.cpp Revert r235154-r235156, they cause asserts when building win64 code (http://crbug.com/477988) 2015-04-17 09:10:43 +00:00
SelectionDAGPrinter.cpp
StatepointLowering.cpp Reduce dyn_cast<> to isa<> or cast<> where possible. 2015-04-10 11:24:51 +00:00
StatepointLowering.h
TargetLowering.cpp
TargetSelectionDAGInfo.cpp