protected void restoreXmlAttributes(XmlElement el) {
			Map<String, String> attributes = el.getAttributes();
			Set<String> keySet = attributes.keySet();
			for (String attrName : keySet) {
				String attrValue = attributes.get(attrName);
				attrName = attrName.toLowerCase();
				switch (attrName) {
					case "after": 
						afterName = attrValue;
						if (afterName.startsWith("func")) {
							hasCodeConstraints = true;
						}
						else if (afterName.startsWith("inst")) {
							hasCodeConstraints = true;
						}
						else if (afterName.startsWith("data")) {
							hasDataConstraints = true;
						}
						else if (afterName.startsWith("ptr")) {
							hasDataConstraints = true;
						}
						else if (afterName.startsWith("def")) {
							hasCodeConstraints = hasDataConstraints = true;
						}
						else {
							Msg.error(this,
								"funcstart pattern attribute 'after' must be one of 'function', 'instruction', 'data', 'defined'");
						}
						break;
					
				    // set check for valid code and the minimum number of instructions required
					// if no maximum is set, then the instructions MUST be fallthru instructions, don't check branch flows
					case "validcode":
						String validcodeStr = attrValue;
						if (validcodeStr.equals("0") || validcodeStr.equals("false")) {
							validCodeMin = NO_VALID_INSTRUCTIONS_REQUIRED;
						}
						else if (validcodeStr.equalsIgnoreCase("true") ||
							validcodeStr.equalsIgnoreCase("subroutine")) { // must be a valid subroutine
							validCodeMin = MUST_HAVE_VALID_INSTRUCTIONS_NO_MIN;
						}
						else if (validcodeStr.equalsIgnoreCase("function")) { // must be at a defined function
							validFunction = true;
							hasFunctionStartConstraints = true;  // enable FunctionStartFuncAnalyzer to run
							validCodeMin = NO_VALID_INSTRUCTIONS_REQUIRED;
						}
						else { // must have <N> valid fallthru instruction to match
							validCodeMin = Integer.parseInt(validcodeStr);
						}
						if (validCodeMax == VALID_INSTRUCTIONS_NO_MAX) {
							// if no maximum instructions to check, only check the minimum number
							validCodeMax = validCodeMin;
						}
						break;
						
			        // set the maximum number of instructions to check
				    // if maximum is set, then allow non fallthru instructions while flowing
					case "validcodemax":
						String validcodeMaxStr = attrValue;
						// check up <N> instructions for valid code
						validCodeMax = Integer.parseInt(validcodeMaxStr);
						if (validCodeMin == NO_VALID_INSTRUCTIONS_REQUIRED) {
							// if set a max and no minimum yet, must have some number of instructions
							// if a validcode minimum is set later, will override this default
							validCodeMin = MUST_HAVE_VALID_INSTRUCTIONS_NO_MIN;
						}
						break;
					
					// minimum number of instructions for validcode must be contiguous instructions
					case "contiguous":
							String fallThruOnlyStr = attrValue;
							// check up <N> instructions for valid code
							contiguous = true;
							if (fallThruOnlyStr.equalsIgnoreCase("false")) {
								contiguous = false;
							}
							else if (fallThruOnlyStr.equalsIgnoreCase("true")) {
								contiguous = true;
							} else {
								Msg.error(this, "Bad contiguous option (true,false): " + attrName + " = " + attrValue);
							}
							break;						
						
					case "label":
						String name = attrValue;
						label = name;
						break;
					
					case "thunk":
						isThunk = true;
						break;
						
					case "noreturn":
						noreturn = true;
						break;
					
					// TODO: add the ability to make data based on a pattern of bytes
					// useful after defined instructions/functions to take up filler byte patterns
					// will allow more finding of code that is after defined data
//					case "data":
//						String validcodeDataStr = attrValue;
//						// create undefined data of the given size
//						makeData = Integer.parseInt(validcodeDataStr);
//						break;
						
					default:
						Msg.error(this, "Unknown Patten option: " + attrName + " = " + attrValue);
				}
			}
		}
Get an existing function right above the addr.
@param program program to check
@param addr address to check
@return true if there is an existing function above addr
Ghidra/Features/BytePatterns/src/main/java/ghidra/app/analyzers/FunctionStartAnalyzer.java