return true;
}
- // FIXME:
// Don't emit locations that cannot be expressed without DW_OP_stack_value.
+ if (DwarfVersion < 4)
+ if (std::any_of(ExprCursor.begin(), ExprCursor.end(),
+ [](DIExpression::ExprOperand Op) -> bool {
+ return Op.getOp() == dwarf::DW_OP_stack_value;
+ })) {
+ DwarfRegs.clear();
+ return false;
+ }
assert(DwarfRegs.size() == 1);
auto Reg = DwarfRegs[0];
}
/// Determine whether there are any operations left in this expression.
operator bool() const { return Start != End; }
+ DIExpression::expr_op_iterator begin() const { return Start; }
+ DIExpression::expr_op_iterator end() const { return End; }
/// Retrieve the fragment information, if any.
Optional<DIExpression::FragmentInfo> getFragmentInfo() const {
; Test dwarf codegen of DW_OP_minus.
; RUN: llc -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -dwarf-version=2 -filetype=obj < %s | llvm-dwarfdump - \
+; RUN: | FileCheck %s --check-prefix=DWARF2
+; RUN: llc -dwarf-version=3 -filetype=obj < %s | llvm-dwarfdump - \
+; RUN: | FileCheck %s --check-prefix=DWARF2
; This was derived manually from:
; int inc(int i) {
; return i+1;
; }
+; DWARF2: .debug_info
+; DWARF2: DW_TAG_formal_parameter
+; DWARF2-NEXT: DW_AT_name {{.*}}"i"
+; DWARF2-NOT: DW_AT_location
+
; CHECK: Beginning address offset: 0x0000000000000000
; CHECK: Ending address offset: 0x0000000000000004
; CHECK: Location description: 70 00 10 ff ff ff ff 0f 1a 10 01 1c 9f